Merge branch 'master' into custom-labels

This commit is contained in:
Miroslav Šedivý
2022-02-27 21:47:03 +01:00
committed by GitHub
5 changed files with 35 additions and 15 deletions
+7
View File
@@ -17,6 +17,7 @@ type Room struct {
NAT1To1IPs []string
NekoImages []string
PathPrefix string
Labels []string
StorageEnabled bool
@@ -62,6 +63,11 @@ func (Room) Init(cmd *cobra.Command) error {
return err
}
cmd.PersistentFlags().String("path_prefix", "", "path prefix that is added to every room path")
if err := viper.BindPFlag("path_prefix", cmd.PersistentFlags().Lookup("path_prefix")); err != nil {
return err
}
cmd.PersistentFlags().StringSlice("labels", []string{}, "additional labels appended to every room")
if err := viper.BindPFlag("labels", cmd.PersistentFlags().Lookup("labels")); err != nil {
return err
@@ -158,6 +164,7 @@ func (s *Room) Set() {
s.NAT1To1IPs = viper.GetStringSlice("nat1to1")
s.NekoImages = viper.GetStringSlice("neko_images")
s.PathPrefix = viper.GetString("path_prefix")
s.Labels = viper.GetStringSlice("labels")
s.StorageEnabled = viper.GetBool("storage.enabled")