8000 fix: ensuring placeholders can be used with --import-realm by shawkins · Pull Request #33589 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

fix: ensuring placeholders can be used with --import-realm - #33589

Merged
vmuzikar merged 1 commit into
keycloak:mainfrom
shawkins:iss33578
Oct 4, 2024
Merged

vmuzikar merged 1 commit into
keycloak:mainfrom
shawkins:iss33578

Conversation

@shawkins
@shawkins shawkins commented Oct 4, 2024
Copy link
Copy Markdown
Contributor

closes: #33578

closes: keycloak#33578

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
if (dir == null) {
throw new IllegalStateException("Import not enabled");
}
ExportImportConfig.setReplacePlaceholders(true);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks like an odd place to set configuration. Can't this be moved somewhere else (maybe the ExportImportManager)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This looks like an odd place to set configuration.

Do you mean you want to get rid of the ExportImportConfig class? That has the responsibility currently of handling all of these system properties.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Another alternative is to default to always replacing placeholders. I think we didn't do that before just to limit the scope of the changes, but as long as the core folks agree then we can remove both of these calls.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you mean you want to get rid of the ExportImportConfig class? That has the responsibility currently of handling all of these system properties.

No, I meant that I don't think we should be calling ExportImportConfig.setReplacePlaceholders(true); from isImportMasterIncludedAtStartup which is essentially just a getter/checker, it should not modify the configuration IMHO.

Another alternative is to default to always replacing placeholders. I think we didn't do that before just to limit the scope of the changes, but as long as the core folks agree then we can remove both of these calls.

That might be a bit out of scope for now.

@shawkins shawkins Oct 4, 2024 •
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, I meant that I don't think we should be calling ExportImportConfig.setReplacePlaceholders(true); from isImportMasterIncludedAtStartup which is essentially just a getter/checker, it should not modify the configuration IMHO.

No, it's not great. It's similar to the issues raised in the TODO about undoing the static state changes. We can move it up, but it's not ideal in KeycloakApplication either.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TBH, it makes more sense to me if it was in KeycloakApplication than in isImportMasterIncludedAtStartup. Feels cleaner.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Let's just resolve this in a follow-up: #33596 - ideally we should be encapsulating as much as possible the usage of static ExportImportConfig logic.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, let's do it as a follow-up.

@vmuzikar vmuzikar left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@shawkins LGTM, thanks.

Can you please create a backport?

{
"realm": "quickstart-realm",
"enabled": true,
"enabled": ${TEST_REALM_ENABLED:true},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We're not explicitly testing if the realm is enabled in the ImportAtStartupDistTest but it should be fine as the import would fail if placeholders were disabled.

if (dir == null) {
throw new IllegalStateException("Import not enabled");
}
ExportImportConfig.setReplacePlaceholders(true);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, let's do it as a follow-up.

@vmuzikar
vmuzikar enabled auto-merge (squash) October 4, 2024 16:50
@vmuzikar
vmuzikar merged commit cb3954f into keycloak:main Oct 4, 2024
shawkins added a commit to shawkins/keycloak that referenced this pull request Oct 4, 2024
…33589)

closes: keycloak#33578

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
(cherry picked from commit cb3954f)
vmuzikar pushed a commit that referenced this pull request Oct 7, 2024
…33598)

closes: #33578

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
(cherry picked from commit cb3954f)
@edewit edewit mentioned this pull request Nov 19, 2024
@edewit edewit mentioned this pull request Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In imported realms, the ability to use environment variables has disappeared

2 participants

0