Skip to content

Make loadConfig public #9101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/lakefs/cmd/flare.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var flareCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
flare.SetBaselinePermissions(flare.FlareUmask)
now := strings.ReplaceAll(time.Now().String(), " ", "")
cfg := loadConfig().GetBaseConfig()
cfg := LoadConfig().GetBaseConfig()
envVarBlacklist := addAppEnvVarPrefix(config.GetSecureStringKeyPaths(cfg))
flr, err := flare.NewFlare(flare.WithEnvVarBlacklist(envVarBlacklist))
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/lakefs/cmd/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var kvGetCmd = &cobra.Command{
Short: "Return the value for the given path under the given partition",
Args: cobra.ExactArgs(GetCmdNumArgs),
RunE: func(cmd *cobra.Command, args []string) error {
cfg := loadConfig().GetBaseConfig()
cfg := LoadConfig().GetBaseConfig()

pretty, err := cmd.Flags().GetBool("pretty")
if err != nil {
Expand Down Expand Up @@ -83,7 +83,7 @@ var kvScanCmd = &cobra.Command{
Short: "Scan through keys and values under the given partition. An optional path can be specified as a starting point (inclusive)",
Args: cobra.RangeArgs(ScanCmdMinArgs, ScanCmdMaxArgs),
RunE: func(cmd *cobra.Command, args []string) error {
cfg := loadConfig().GetBaseConfig()
cfg := LoadConfig().GetBaseConfig()

limit, err := cmd.Flags().GetInt("limit")
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions cmd/lakefs/cmd/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var versionCmd = &cobra.Command{
Use: "version",
Short: "Print current migration version and available version",
Run: func(cmd *cobra.Command, args []string) {
cfg := loadConfig().GetBaseConfig()
cfg := LoadConfig().GetBaseConfig()
kvParams, err := kvparams.NewConfig(&cfg.Database)
if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "KV params: %s\n", err)
Expand Down Expand Up @@ -63,7 +63,7 @@ var upCmd = &cobra.Command{
Use: "up",
Short: "Apply all up migrations",
Run: func(cmd *cobra.Command, args []string) {
cfg := loadConfig().GetBaseConfig()
cfg := LoadConfig().GetBaseConfig()
kvParams, err := kvparams.NewConfig(&cfg.Database)
if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "KV params: %s\n", err)
Expand Down Expand Up @@ -136,7 +136,7 @@ var gotoCmd = &cobra.Command{
Use: "goto",
Short: "Migrate to version V.",
Run: func(cmd *cobra.Command, args []string) {
cfg := loadConfig().GetBaseConfig()
cfg := LoadConfig().GetBaseConfig()
kvParams, err := kvparams.NewConfig(&cfg.Database)
if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "KV params: %s\n", err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakefs/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func newConfig() (config.Config, error) {
return cfg, nil
}

func loadConfig() config.Config {
func LoadConfig() config.Config {
log := logging.ContextUnavailable().WithField("phase", "startup")
initOnce.Do(func() {
initConfig(log)
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakefs/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var runCmd = &cobra.Command{
Short: "Run lakeFS",
Run: func(cmd *cobra.Command, args []string) {
logger := logging.ContextUnavailable()
cfg := loadConfig()
cfg := LoadConfig()
baseCfg := cfg.GetBaseConfig()
viper.WatchConfig()
viper.OnConfigChange(func(in fsnotify.Event) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakefs/cmd/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var setupCmd = &cobra.Command{
Aliases: []string{"init"},
Short: "Setup a new lakeFS instance with initial credentials",
Run: func(cmd *cobra.Command, args []string) {
cfg := loadConfig()
cfg := LoadConfig()
authConfig := cfg.AuthConfig()
baseConfig := cfg.GetBaseConfig()

Expand Down
6 changes: 3 additions & 3 deletions cmd/lakefs/cmd/superuser.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ var superuserCmd = &cobra.Command{
Use: "superuser",
Short: "Create additional user with admin credentials",
Long: `Create additional user with admin credentials.
This command can be used to import an admin user when moving from lakeFS version
This command can be used to import an admin user when moving from lakeFS version
with previously configured users to a lakeFS with basic auth version.
To do that provide the user name as well as the access key ID to import.
To do that provide the user name as well as the access key ID to import.
If the wrong user or credentials were chosen it is possible to delete the user and perform the action again.
`,
Run: func(cmd *cobra.Command, args []string) {
cfg := loadConfig()
cfg := LoadConfig()
authConfig := cfg.AuthConfig()
baseConfig := cfg.GetBaseConfig()
if authConfig.UIConfig.RBAC == config.AuthRBACExternal {
Expand Down
Loading