Skip to content

Commit

Permalink
Allow env vars to be passed in (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
edaniels committed Apr 8, 2024
1 parent 1846c71 commit 925cde4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion web/cmd/droid/droid.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package droid

import (
"os"
"strings"

"go.viam.com/utils"

Expand All @@ -23,7 +24,11 @@ func DroidStopHook() {
server.ForceRestart = true
}

func MainEntry(configPath, writeablePath string) {
func MainEntry(configPath, writeablePath, osEnv string) {
os.Args = append(os.Args, "-config", configPath)
for _, envEntry := range strings.Split(osEnv, "\n") {
entryParts := strings.SplitN(envEntry, "=", 2)
os.Setenv(entryParts[0], entryParts[1])
}
utils.ContextualMain(server.RunServer, logger)
}

0 comments on commit 925cde4

Please sign in to comment.