Skip to content

feat(cli): Added command line arguments for overriding storage type and storage config - #42

Open
anandf wants to merge 1 commit into
rh-gitops-midstream:v2.45.0from
anandf:add_storage_args
Open

feat(cli): Added command line arguments for overriding storage type and storage config#42
anandf wants to merge 1 commit into
rh-gitops-midstream:v2.45.0from
anandf:add_storage_args

Conversation

@anandf

@anandf anandf commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread cmd/dex/serve.go Outdated
logger.Info("env overrides for dex storage",
"DEX_STORAGE_TYPE", os.Getenv("DEX_STORAGE_TYPE"),
"DEX_STORAGE_CONFIG", os.Getenv("DEX_STORAGE_CONFIG"),
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this may log some credentials for other storage type if provided, better we can ignore it or log only type.

Comment thread cmd/dex/serve.go Outdated
defer s.Close()

logger.Info("config storage", "storage_type", c.Storage.Type)
logger.Info("config storage", "storage_config", c.Storage.Config)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this too.

Comment thread cmd/dex/serve.go
}
config.Storage.Type = options.storageType
storageConfig := f()
if len(options.storageConfig) != 0 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in next iteration, what if storage type is change, but not config. the options still has new storage type and old config which may cause problem for dex pod to start

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

storageConfig := f()

if len(options.storageConfig) != 0 {
// expand + unmarshal
}

config.Storage.Type = options.storageType
config.Storage.Config = storageConfig

Comment thread cmd/dex/serve.go Outdated

err = applyConfigOverrides(options, &c)
if err != nil {
return fmt.Errorf("error overriding values for storage type %q and storage config %q: %v", options.storageType, options.storageConfig, err)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can also leak if any credentials exist in config

Comment thread cmd/dex/serve.go Outdated
if !ok {
return fmt.Errorf("unknown storage type %q", options.storageType)
}
config.Storage.Type = options.storageType

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can have this at last, where we are appending config, if unmarshal fails it will be partial setting.

Comment thread cmd/dex/serve.go
…nd storage config

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants