func (za *ZkApp) AddDependerEnvData(data *types.DependerEnvData) error { if za.DependerEnvData == nil { za.DependerEnvData = map[string]*types.DependerEnvData{} } if _, err := GetEnv(data.Name); err != nil { return err } crypto.EncryptDependerEnvData(data) za.DependerEnvData[data.Name] = data return za.Save() }
func (za *ZkApp) AddDependerEnvDataForDependerApp(app string, data *types.DependerEnvData) error { if _, err := GetApp(app); err != nil { return err } if _, err := GetEnv(data.Name); err != nil { return err } dad := za.GetDependerAppData(app, false) if dad == nil { dad = &types.DependerAppData{Name: app, DependerEnvData: map[string]*types.DependerEnvData{}} } crypto.EncryptDependerEnvData(data) dad.DependerEnvData[data.Name] = data za.DependerAppData[app] = dad return za.Save() }