1
0
mirror of https://github.com/rancher/os.git synced 2025-04-28 11:24:26 +00:00

Add export filter of additional property

This commit is contained in:
wchao1241 2018-05-02 14:21:57 +08:00
parent 41a3330d89
commit a9eb57759c
2 changed files with 14 additions and 0 deletions

View File

@ -35,6 +35,7 @@ func Merge(bytes []byte) error {
func Export(private, full bool) (string, error) {
rawCfg := loadRawConfig("", full)
rawCfg = filterAdditional(rawCfg)
if !private {
rawCfg = filterPrivateKeys(rawCfg)
}
@ -50,6 +51,14 @@ func filterPrivateKeys(data map[interface{}]interface{}) map[interface{}]interfa
return data
}
func filterAdditional(data map[interface{}]interface{}) map[interface{}]interface{} {
for _, additional := range Additional {
_, data = filterKey(data, strings.Split(additional, "."))
}
return data
}
func Get(key string) (interface{}, error) {
cfg := LoadConfig()

View File

@ -67,6 +67,11 @@ var (
"rancher.docker.server_key",
"rancher.docker.server_cert",
}
Additional = []string{
"rancher.password",
"rancher.autologin",
"EXTRA_CMDLINE",
}
)
func init() {