Skip to main content

Auth Configuration

The auth module uses environment variables for Keycloak connections. Set these in your .env file.

Required Variables

VariableDescriptionExample
KC_SOURCE_URLSource Keycloak base URLhttps://keycloak-dev.example.com
KC_SOURCE_ADMIN_USERSource admin usernameadmin
KC_SOURCE_ADMIN_PASSSource admin passwordpassword123
KC_SOURCE_REALMRealm name to exportmyapp-realm
KC_TARGET_URLTarget Keycloak base URLhttps://keycloak-staging.example.com
KC_TARGET_ADMIN_USERTarget admin usernameadmin
KC_TARGET_ADMIN_PASSTarget admin passwordpassword123

Optional Variables

VariableDescriptionDefault
RAW_EXPORT_DIRRaw export directory.tmp-config
CLEAN_OUTPUT_DIRCleaned output directoryrealm-config
OUTPUT_FILENAMEOutput filenamepro-application-realm.json
KC_CONFIG_CLI_IMAGEDocker image for importadorsys/keycloak-config-cli:6.4.0-24

Example .env File

# Source Keycloak
KC_SOURCE_URL=https://keycloak-dev.example.com
KC_SOURCE_ADMIN_USER=admin
KC_SOURCE_ADMIN_PASS=dev-password
KC_SOURCE_REALM=myapp-realm

# Target Keycloak
KC_TARGET_URL=https://keycloak-staging.example.com
KC_TARGET_ADMIN_USER=admin
KC_TARGET_ADMIN_PASS=staging-password

# Optional
RAW_EXPORT_DIR=.tmp-config
CLEAN_OUTPUT_DIR=realm-config
OUTPUT_FILENAME=myapp-realm.json