feat: allow use system enviroment variables

master
windwp 2 years ago committed by GitHub
parent 3399f02a6e
commit 73fed621b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -67,6 +67,10 @@ func ParseConfig(data string, settings map[string]string) (Config, error) {
return val
}
if val, ok := os.LookupEnv(v); ok {
return val
}
return v
})

@ -1,6 +1,7 @@
package main
import (
"os"
"reflect"
"testing"
)
@ -15,6 +16,7 @@ windows:
panes:
- commands:
- echo 2
- echo ${HOME}
type: horizontal`
config, err := ParseConfig(yaml, map[string]string{
@ -33,7 +35,7 @@ windows:
Panes: []Pane{
{
Type: "horizontal",
Commands: []string{"echo 2"},
Commands: []string{"echo 2", "echo " + os.Getenv("HOME")},
},
},
},

Loading…
Cancel
Save