Skip to content
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

Is it possible to pass the database to Keycloak with aspire hosting? #113

Open
nodew opened this issue Jun 3, 2024 · 1 comment
Open
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@nodew
Copy link

nodew commented Jun 3, 2024

What I want to do is as the follow:

var pg = builder.AddPostgres("postgresql");

var keycloak = builder
    .AddKeycloakContainer("keycloak")
    .WithDatabase(pg)
    ...
@NikiforovAll
Copy link
Owner

This feature is not implemented. However, you could use existing implementation and override arguments. Based on: https://www.keycloak.org/server/db

If we are talking about extending this library to support such a scenario, we can do that and I'm open for contribution.


Design Considerations

We could implement it as suggested in the original post, but there are downsides to that - taking a dependency on actual database components is, probably, not a good idea. Let's discuss it.

Solution 1 - take dependencies on Aspire components

Since Keycloak supports only a subset of databases, it should be easy to add support for main databases.

Solution 2 - adapter

We could provide a simple adapter.
E.g:

var pg = builder.AddPostgres("postgresql");

var pga = new KeycloakDbAdapter(pg);

var keycloak = builder
    .AddKeycloakContainer("keycloak")
    .WithDatabase(pga);

The Adapter could define something like this:

public interface IKeycloakDbAdapter
{
    KeycloakCredential GetKeycloakCredential()
}

@NikiforovAll NikiforovAll added enhancement New feature or request question Further information is requested help wanted Extra attention is needed labels Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants