add new envs

This commit is contained in:
Lunny Xiao
2022-11-04 17:23:59 +08:00
committed by Jason Song
parent 93e42d1465
commit 222b5100b6
4 changed files with 19 additions and 13 deletions

View File

@ -75,9 +75,18 @@ func FromEnviron() (Config, error) {
cfg.ForgeInstance = runner.ForgeInstance
}
cfg.Client.Address = fmt.Sprintf(
"%s://%s",
cfg.Client.Proto,
cfg.Client.Host,
)
// runner config
if cfg.Runner.Environ == nil {
cfg.Runner.Environ = map[string]string{}
cfg.Runner.Environ = map[string]string{
"GITHUB_API_URL": cfg.Client.Address + "/api/v1",
"GITHUB_SERVER_URL": cfg.Client.Address,
}
}
if cfg.Runner.Name == "" {
cfg.Runner.Name, _ = os.Hostname()
@ -91,12 +100,6 @@ func FromEnviron() (Config, error) {
cfg.Platform.Arch = runtime.GOARCH
}
cfg.Client.Address = fmt.Sprintf(
"%s://%s",
cfg.Client.Proto,
cfg.Client.Host,
)
if file := cfg.Runner.EnvFile; file != "" {
envs, err := godotenv.Read(file)
if err != nil {