Skip to content

Conversation

IanMoroney
Copy link

@IanMoroney IanMoroney commented Apr 3, 2025

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

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.

@IanMoroney IanMoroney requested a review from a team as a code owner April 3, 2025 11:49
Copy link

bunnyshell bot commented Apr 3, 2025

❌ Preview Environment undeployed from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

@IanMoroney
Copy link
Author

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.

@IanMoroney IanMoroney changed the title allow dex storage to be configured feat:(dex) allow dex storage to be configured #7089 Apr 3, 2025
Ian Moroney and others added 2 commits April 3, 2025 12:19
Signed-off-by: Ian Moroney <ianmoroney@gmail.com>
Signed-off-by: Ian Moroney <ianmoroney@gmail.com>
@IanMoroney IanMoroney force-pushed the feature/dex-storage branch from dd3bceb to 29a99d0 Compare April 3, 2025 12:19
Copy link

codecov bot commented Apr 3, 2025

Codecov Report

❌ Patch coverage is 78.94737% with 4 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@48a7030). Learn more about missing BASE report.

Files with missing lines Patch % Lines
util/dex/config.go 78.94% 3 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

@IanMoroney
Copy link
Author

@crenshaw-dev , any feedback on this if possible?

@IanMoroney
Copy link
Author

@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 {
Copy link
Member

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 {
Copy link
Member

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")
Copy link
Member

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 ?

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.

Run dex server in HA
4 participants