mirror of
https://github.com/dredx/prole.git
synced 2026-09-24 16:34:31 +00:00
- Moved prole-tools-app to prole-app at the project root to make it self-contained for transition to its own repository. - Created prole-tools-app/dist/ directory to host build artifacts. - Generated distribution artifacts (Prole Tools.app and Prole Tools.zip) using prole-app/build.sh package. - Checked in the generated artifacts to prole-tools-app/dist/ (bypassing .gitignore for temporary release process). Changes Summary • Renamed directory prole-tools-app/ to prole-app/. • Populated prole-tools-app/dist/ with the latest build output from prole-app/build.sh. • Staged all changes, including the forced addition of ignored artifacts in prole-tools-app/dist/.
40 lines
1.5 KiB
Swift
40 lines
1.5 KiB
Swift
import Foundation
|
|
|
|
enum ProleEnv {
|
|
static func proleHome() -> URL {
|
|
let env = ProcessInfo.processInfo.environment
|
|
let home = env["HOME"] ?? NSHomeDirectory()
|
|
let proleHome = env["PROLE_HOME"] ?? home
|
|
return URL(fileURLWithPath: proleHome, isDirectory: true)
|
|
}
|
|
|
|
static func logsDir() -> URL {
|
|
return proleHome().appendingPathComponent("logs", isDirectory: true)
|
|
}
|
|
|
|
static func confDir() -> URL {
|
|
return proleHome().appendingPathComponent("conf", isDirectory: true)
|
|
}
|
|
|
|
static func bootstrap() {
|
|
let fm = FileManager.default
|
|
// Ensure base, logs, conf
|
|
for dir in [proleHome(), logsDir(), confDir()] {
|
|
try? fm.createDirectory(at: dir, withIntermediateDirectories: true)
|
|
}
|
|
// Ensure conf/port-mappings.conf exists
|
|
let pm = confDir().appendingPathComponent("port-mappings.conf")
|
|
if !fm.fileExists(atPath: pm.path) {
|
|
let tpl = """
|
|
# Port mappings for Prole Tools (read by scripts).
|
|
# Format examples:
|
|
# grafana: local=3000 remote=80 ns=default svc=prometheus-community-grafana address=0.0.0.0
|
|
# db: local=5432 remote=5432 ns=default svc=prole-db-rw address=0.0.0.0
|
|
|
|
# Add your mappings below. One mapping per line as key=value tokens.
|
|
"""
|
|
try? tpl.trimmingCharacters(in: .whitespacesAndNewlines).appending("\n").write(to: pm, atomically: true, encoding: .utf8)
|
|
}
|
|
}
|
|
}
|