scripting improvements

This commit is contained in:
Alon Girmonsky 2024-10-21 12:58:01 -07:00
parent f026c3604a
commit 7b94c9beff
2 changed files with 12 additions and 2 deletions

View File

@ -70,6 +70,7 @@ func createScript(provider *kubernetes.Provider, script misc.ConfigMapScript) (i
}
scripts[index] = script
log.Info().Str("title", script.Title).Bool("Active", script.Active).Int64("Index", index).Msg("Creating script")
var data []byte
data, err = json.Marshal(scripts)
if err != nil {
@ -146,7 +147,7 @@ func watchScripts(provider *kubernetes.Provider, block bool) {
index, err := createScript(provider, script.ConfigMap())
if err != nil {
log.Error().Err(err).Send()
return
continue
}
files[script.Path] = index

View File

@ -84,7 +84,16 @@ func SetConfig(provider *Provider, key string, value string) (updated bool, err
_, err = provider.clientSet.CoreV1().ConfigMaps(config.Config.Tap.Release.Namespace).Update(context.TODO(), configMap, metav1.UpdateOptions{})
if err == nil {
if updated {
log.Info().Str("config", key).Str("value", value).Msg("Updated:")
log.Info().
Str("config", key).
Str("value", func() string {
if len(value) > 10 {
return value[:10]
}
return value
}()).
Int("length", len(value)).
Msg("Updated. Printing only 10 first characters of value:")
}
} else {
log.Error().Str("config", key).Err(err).Send()