mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-08 04:20:07 +02:00
✨ Read Valet configuration (#58)
This commit is contained in:
@ -11,14 +11,24 @@ import Foundation
|
|||||||
class Valet {
|
class Valet {
|
||||||
|
|
||||||
var version: String
|
var version: String
|
||||||
|
var config: ValetConfiguration
|
||||||
var detectedSites: [String]
|
var detectedSites: [String]
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
// Let's see if we can't discern what the Valet version is
|
|
||||||
// but in order to do so, we'll need to be able to run Valet
|
|
||||||
// which has, historically, been kind of a pain in the butt
|
|
||||||
self.version = Actions.valet("--version")
|
self.version = Actions.valet("--version")
|
||||||
.replacingOccurrences(of: "Laravel Valet ", with: "")
|
.replacingOccurrences(of: "Laravel Valet ", with: "")
|
||||||
|
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
|
|
||||||
|
let file = FileManager.default.homeDirectoryForCurrentUser
|
||||||
|
.appendingPathComponent(".config/valet/config.json")
|
||||||
|
|
||||||
|
self.config = try! JSONDecoder().decode(
|
||||||
|
ValetConfiguration.self,
|
||||||
|
from: try! String(contentsOf: file, encoding: .utf8).data(using: .utf8)!
|
||||||
|
)
|
||||||
|
|
||||||
|
print("PHP Monitor should scan the following paths:")
|
||||||
|
print(self.config.paths)
|
||||||
|
|
||||||
self.detectedSites = []
|
self.detectedSites = []
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user