MCPcopy Index your code
hub / github.com/filebrowser/filebrowser / generateEnvKeyReplacements

Function generateEnvKeyReplacements

cmd/utils.go:73–83  ·  view source on GitHub ↗

Generate the replacements for all environment variables. This allows to use FB_BRANDING_DISABLE_EXTERNAL environment variables, even when the option name is branding.disableExternal.

(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

71// use FB_BRANDING_DISABLE_EXTERNAL environment variables, even when the
72// option name is branding.disableExternal.
73func generateEnvKeyReplacements(cmd *cobra.Command) []string {
74 replacements := []string{}
75
76 cmd.Flags().VisitAll(func(f *pflag.Flag) {
77 oldName := strings.ToUpper(f.Name)
78 newName := strings.ToUpper(lo.SnakeCase(f.Name))
79 replacements = append(replacements, oldName, newName)
80 })
81
82 return replacements
83}
84
85func initViper(cmd *cobra.Command) (*viper.Viper, error) {
86 v := viper.New()

Callers 2

testEnvCollisionsFunction · 0.85
initViperFunction · 0.85

Calls

no outgoing calls

Tested by 1

testEnvCollisionsFunction · 0.68