-
Notifications
You must be signed in to change notification settings - Fork 6.4k
feat:(dex) allow dex storage to be configured #7089 #22559
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
base: master
Are you sure you want to change the base?
feat:(dex) allow dex storage to be configured #7089 #22559
Conversation
❌ Preview Environment undeployed from BunnyshellAvailable commands (reply to this comment):
|
I'd be happy to include some documentation for this to indicate that this is now possible, i'll just need a steer on where I should put that documentation. |
Signed-off-by: Ian Moroney <ianmoroney@gmail.com>
Signed-off-by: Ian Moroney <ianmoroney@gmail.com>
dd3bceb
to
29a99d0
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #22559 +/- ##
=========================================
Coverage ? 60.31%
=========================================
Files ? 347
Lines ? 59325
Branches ? 0
=========================================
Hits ? 35780
Misses ? 20694
Partials ? 2851 ☔ View full report in Codecov by Sentry. |
@crenshaw-dev , any feedback on this if possible? |
@csantanapr or @nitishfy or @rumstead , would someone be able to review this? it's a very useful improvement for the dex implementation |
// needsStorageConfig returns whether or not the given storage type needs a config block | ||
// Update this list as necessary, as new storage types are added | ||
// https://dexidp.io/docs/configuration/storage/ | ||
func needsStorageConfig(storageType string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think with usage
types := []string{"sqlite3", "postgres", "mysql"}
slices.Contains(types, "sqlite3") // true
It will looks better
dexCfg["storage"] = map[string]any{ | ||
"type": "memory", | ||
|
||
if storage, found := dexCfg["storage"].(map[string]any); found { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please move it to dedicated function that will return storage type ?
} | ||
if needsStorageConfig(storageType) { | ||
if _, configFound := storage["config"].(map[string]any); !configFound { | ||
return nil, errors.New("malformed Dex configuration found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use memory in such case and not throw exception ?
Checklist:
Closes #7089
This PR allows for different storage options to be presented to the Dex config, and if no storage option is given, reverts to the current in-memory storage.