mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
chore: Update launch.json and config.go for InfrastructureAgent
This commit is contained in:
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
@@ -19,6 +19,14 @@
|
||||
}
|
||||
],
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Debug Infrastructure Agent",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "debug",
|
||||
"program": "./InfrastructureAgent",
|
||||
"args": ["start"]
|
||||
},
|
||||
{
|
||||
"name": "Node.js - Debug Current File",
|
||||
"type": "node",
|
||||
|
||||
@@ -116,7 +116,7 @@ func (c *ConfigFile) configPath() string {
|
||||
}
|
||||
|
||||
// Define the directory path where the configuration file will be stored.
|
||||
configDirectory := filepath.Join(basePath, "oneuptime_infrastructure_agent")
|
||||
configDirectory := filepath.Join(basePath, "oneuptime-infrastructure-agent")
|
||||
|
||||
// Ensure the directory exists.
|
||||
err := c.ensureDir(configDirectory)
|
||||
|
||||
@@ -116,11 +116,12 @@ func main() {
|
||||
slog.Error("Failed to install service: ", err)
|
||||
os.Exit(2)
|
||||
}
|
||||
fmt.Println("Service installed")
|
||||
fmt.Println("Service installed. Run the service using 'oneuptime-infrastructure-agent start'")
|
||||
|
||||
case "start":
|
||||
err := prg.config.loadConfig()
|
||||
if os.IsNotExist(err) {
|
||||
slog.Error("Service configuration not found. Please install the service properly.")
|
||||
slog.Error("Service configuration not found. Please run 'oneuptime-infrastructure-agent install' to install the service.")
|
||||
os.Exit(2)
|
||||
}
|
||||
if err != nil {
|
||||
@@ -128,15 +129,17 @@ func main() {
|
||||
os.Exit(2)
|
||||
}
|
||||
if err != nil || prg.config.SecretKey == "" || prg.config.OneUptimeURL == "" {
|
||||
slog.Error("Service configuration not found or is incomplete. Please install the service properly.")
|
||||
slog.Error("Service configuration not found or is incomplete. Please run 'oneuptime-infrastructure-agent install' to install the service.")
|
||||
os.Exit(2)
|
||||
}
|
||||
err = s.Start()
|
||||
if err != nil {
|
||||
|
||||
slog.Error(err.Error())
|
||||
os.Exit(2)
|
||||
}
|
||||
slog.Info("Service Started")
|
||||
slog.Info("OneUptime Infrastructure Agent Started")
|
||||
|
||||
case "run":
|
||||
err := prg.config.loadConfig()
|
||||
if os.IsNotExist(err) {
|
||||
@@ -156,6 +159,7 @@ func main() {
|
||||
slog.Error(err.Error())
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
case "uninstall", "stop", "restart":
|
||||
err := service.Control(s, cmd)
|
||||
if err != nil {
|
||||
@@ -174,9 +178,11 @@ func main() {
|
||||
if cmd == "stop" {
|
||||
slog.Info("Service Stopped")
|
||||
}
|
||||
|
||||
// add help command
|
||||
case "help":
|
||||
fmt.Println("Usage: oneuptime-infrastructure-agent install | uninstall | start | stop | restart")
|
||||
|
||||
default:
|
||||
slog.Error("Invalid command")
|
||||
os.Exit(2)
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user