-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add scale command for handling bot count (#33)
- Loading branch information
1 parent
3d77862
commit 6302c03
Showing
2 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package utils | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/spf13/viper" | ||
"gopkg.in/yaml.v3" | ||
) | ||
|
||
func UpdateViperConfig(key string, value any, configFile string) error { | ||
viper.Set(key, value) | ||
|
||
updatedConfig, err := yaml.Marshal(viper.AllSettings()) | ||
if err != nil { | ||
fmt.Printf("unable to marshal config to yaml: %v\n", err) | ||
} | ||
|
||
err = os.WriteFile(configFile, updatedConfig, 0o644) | ||
if err != nil { | ||
fmt.Printf("failed to update config file: %v\n", err) | ||
} | ||
|
||
return nil | ||
} |