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

Automate Configuration File and Environment Variable Setup with Symfony Flex #1

Open
mainick opened this issue Oct 8, 2023 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@mainick
Copy link
Owner

mainick commented Oct 8, 2023

As per the README instructions, the current process requires manual configuration by creating a configuration file for the KeycloakClientBundle and adding environment variables before installing the package. This can be streamlined using the symfony recipes allow the automation of Composer packages configuration via the Symfony Flex Composer plugin.
Hence, I propose the following enhancements:

Automated Configuration File:

Symfony Flex can be leveraged to generate the mainick_keycloak_client.yaml configuration file in the config/packages directory. This file should contain the following default configuration structure:

# config/packages/mainick_keycloak_client.yaml

mainick_keycloak_client:
    keycloak:
        verify_ssl: '%env(bool:IAM_VERIFY_SSL)%'
        base_url: '%env(IAM_BASE_URL)%'
        realm: '%env(IAM_REALM)%'
        client_id: '%env(IAM_CLIENT_ID)%'
        client_secret: '%env(IAM_CLIENT_SECRET)%'
        redirect_uri: '%env(IAM_REDIRECT_URI)%'
        encryption_algorithm: '%env(IAM_ENCRYPTION_ALGORITHM)%'
        encryption_key: '%env(IAM_ENCRYPTION_KEY)%'
        encryption_key_path: '%env(IAM_ENCRYPTION_KEY_PATH)%'
        version: '%env(IAM_VERSION)%'

Automated Environment Variable Setup:

Symfony Flex can also add placeholders for the required environment variables in your project's environment file (e.g., .env or .env.local). The placeholders should look like this:

###> mainick/keycloak-client-bundle ###
IAM_VERIFY_SSL=true # Verify SSL certificate
IAM_BASE_URL='<your-base-server-url>'  # Keycloak server URL
IAM_REALM='<your-realm>' # Keycloak realm name
IAM_CLIENT_ID='<your-client-id>' # Keycloak client id
IAM_CLIENT_SECRET='<your-client-secret>' # Keycloak client secret
IAM_REDIRECT_URI='<your-redirect-uri>' # Keycloak redirect uri
IAM_ENCRYPTION_ALGORITHM='<your-algorithm>' # RS256, HS256, etc.
IAM_ENCRYPTION_KEY='<your-public-key>' # public key
IAM_ENCRYPTION_KEY_PATH='<your-public-key-path>' # public key path
IAM_VERSION='<your-version-keycloak>' # Keycloak version
###< mainick/keycloak-client-bundle ###

With these enhancements, the package's configuration and environment variable setup can be automated, simplifying the installation process.

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
Projects
None yet
Development

No branches or pull requests

1 participant