This is an automated email from the ASF dual-hosted git repository.
klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 69afaf5c fix: the github plugin settings info can not save to .env
(#1896)
69afaf5c is described below
commit 69afaf5c23c07500284d222219d71425dba2d9ef
Author: abeizn <[email protected]>
AuthorDate: Thu May 19 11:33:03 2022 +0800
fix: the github plugin settings info can not save to .env (#1896)
* fix(github): github connection properties are saved with error
closes #1888
* fix(github): github connection properties are saved with error
* fix(github): github connection properties are saved with error
* fix(github): github connection properties are saved with error
* fix(github): github connection properties are saved with error
* fix: the github plugin settings info can not save to .env
* fix: the github plugin settings info can not save to .env
Co-authored-by: Yingchu Chen <[email protected]>
---
config/config.go | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/config/config.go b/config/config.go
index af524ea8..6a1c4ca9 100644
--- a/config/config.go
+++ b/config/config.go
@@ -98,11 +98,16 @@ func WriteConfigAs(v *viper.Viper, filename string) error {
}
defer f.Close()
+ for _, key := range v.AllKeys() {
+ envName := strings.ToUpper(key)
+ if !strings.Contains(envFileContent, envName) {
+ envFileContent = fmt.Sprintf("%s\n%s=", envFileContent,
envName)
+ }
+ }
err, envFileContent = replaceNewEnvItemInOldContent(v, envFileContent)
if err != nil {
return err
}
-
if _, err := f.WriteString(envFileContent); err != nil {
return err
}