From d37913005b50e307d606d9e771af319a5efb28fe Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Mon, 29 Nov 2021 01:42:09 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Read=20Valet=20configuration=20(#58?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- phpmon/Domain/Integrations/Valet/Valet.swift | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/phpmon/Domain/Integrations/Valet/Valet.swift b/phpmon/Domain/Integrations/Valet/Valet.swift index cec4e78..e1ab39c 100644 --- a/phpmon/Domain/Integrations/Valet/Valet.swift +++ b/phpmon/Domain/Integrations/Valet/Valet.swift @@ -11,14 +11,24 @@ import Foundation class Valet { var version: String + var config: ValetConfiguration var detectedSites: [String] 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") .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 = [] }