mirror of
https://github.com/fosrl/olm.git
synced 2026-02-08 05:56:41 +00:00
Fix pulling config.json (#39)
This commit is contained in:
43
main.go
43
main.go
@@ -63,8 +63,15 @@ func main() {
|
||||
}
|
||||
|
||||
// Handle service management commands on Windows
|
||||
if runtime.GOOS == "windows" && len(os.Args) > 1 {
|
||||
switch os.Args[1] {
|
||||
if runtime.GOOS == "windows" {
|
||||
var command string
|
||||
if len(os.Args) > 1 {
|
||||
command = os.Args[1]
|
||||
} else {
|
||||
command = "default"
|
||||
}
|
||||
|
||||
switch command {
|
||||
case "install":
|
||||
err := installService()
|
||||
if err != nil {
|
||||
@@ -147,6 +154,7 @@ func main() {
|
||||
fmt.Println(" stop Stop the service")
|
||||
fmt.Println(" status Show service status")
|
||||
fmt.Println(" debug Run service in debug mode")
|
||||
fmt.Println(" logs Tail the service log file")
|
||||
fmt.Println("\nFor console mode, run without arguments or with standard flags.")
|
||||
return
|
||||
default:
|
||||
@@ -402,6 +410,22 @@ func runOlmMainWithArgs(ctx context.Context, args []string) {
|
||||
// }
|
||||
// }
|
||||
|
||||
// Create a new olm
|
||||
olm, err := websocket.NewClient(
|
||||
"olm",
|
||||
id, // CLI arg takes precedence
|
||||
secret, // CLI arg takes precedence
|
||||
endpoint,
|
||||
pingInterval,
|
||||
pingTimeout,
|
||||
)
|
||||
if err != nil {
|
||||
logger.Fatal("Failed to create olm: %v", err)
|
||||
}
|
||||
endpoint = olm.GetConfig().Endpoint // Update endpoint from config
|
||||
id = olm.GetConfig().ID // Update ID from config
|
||||
secret = olm.GetConfig().Secret // Update secret from config
|
||||
|
||||
// wait until we have a client id and secret and endpoint
|
||||
waitCount := 0
|
||||
for id == "" || secret == "" || endpoint == "" {
|
||||
@@ -439,21 +463,6 @@ func runOlmMainWithArgs(ctx context.Context, args []string) {
|
||||
logger.Fatal("Failed to generate private key: %v", err)
|
||||
}
|
||||
|
||||
// Create a new olm
|
||||
olm, err := websocket.NewClient(
|
||||
"olm",
|
||||
id, // CLI arg takes precedence
|
||||
secret, // CLI arg takes precedence
|
||||
endpoint,
|
||||
pingInterval,
|
||||
pingTimeout,
|
||||
)
|
||||
if err != nil {
|
||||
logger.Fatal("Failed to create olm: %v", err)
|
||||
}
|
||||
endpoint = olm.GetConfig().Endpoint // Update endpoint from config
|
||||
id = olm.GetConfig().ID // Update ID from config
|
||||
|
||||
// Create TUN device and network stack
|
||||
var dev *device.Device
|
||||
var wgData WgData
|
||||
|
||||
Reference in New Issue
Block a user