mirror of
https://github.com/rancher/os.git
synced 2025-04-29 11:54:18 +00:00
Add export filter of additional property
This commit is contained in:
parent
41a3330d89
commit
a9eb57759c
@ -35,6 +35,7 @@ func Merge(bytes []byte) error {
|
|||||||
|
|
||||||
func Export(private, full bool) (string, error) {
|
func Export(private, full bool) (string, error) {
|
||||||
rawCfg := loadRawConfig("", full)
|
rawCfg := loadRawConfig("", full)
|
||||||
|
rawCfg = filterAdditional(rawCfg)
|
||||||
if !private {
|
if !private {
|
||||||
rawCfg = filterPrivateKeys(rawCfg)
|
rawCfg = filterPrivateKeys(rawCfg)
|
||||||
}
|
}
|
||||||
@ -50,6 +51,14 @@ func filterPrivateKeys(data map[interface{}]interface{}) map[interface{}]interfa
|
|||||||
return data
|
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) {
|
func Get(key string) (interface{}, error) {
|
||||||
cfg := LoadConfig()
|
cfg := LoadConfig()
|
||||||
|
|
||||||
|
@ -67,6 +67,11 @@ var (
|
|||||||
"rancher.docker.server_key",
|
"rancher.docker.server_key",
|
||||||
"rancher.docker.server_cert",
|
"rancher.docker.server_cert",
|
||||||
}
|
}
|
||||||
|
Additional = []string{
|
||||||
|
"rancher.password",
|
||||||
|
"rancher.autologin",
|
||||||
|
"EXTRA_CMDLINE",
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
Loading…
Reference in New Issue
Block a user