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

feat: consistent env vars #79

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 20 additions & 21 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
DIRECTUS_URL = "http://localhost:8055"
DIRECTUS_HOSTNAME = 'localhost'
DIRECTUS_KEY = 'changeme'
DIRECTUS_SECRET = 'changeme'
DIRECTUS_DB_PASSWORD = 'changeme'
DIRECTUS_DOMAIN = "localhost"
DIRECTUS_KEY = "changeme"
DIRECTUS_SECRET = "changeme"
DIRECTUS_DB_PASSWORD = "changeme"
DIRECTUS_ADMIN_EMAIL = "[email protected]"
DIRECTUS_ADMIN_PASSWORD = "d1r3ctu5"

DIRECTUS_EMAIL_FROM = ""
DIRECTUS_EMAIL_TRANSPORT = "smtp"
Expand All @@ -12,21 +14,18 @@ DIRECTUS_EMAIL_SMTP_USER = ""
DIRECTUS_EMAIL_SMTP_PASSWORD = ""

KEYCLOAK_URL = "http://keycloak:8080"
KEYCLOAK_HOSTNAME = 'keycloak'
KEYCLOAK_ADMIN = '[email protected]'
KEYCLOAK_ADMIN_PASSWORD = 'admin'
KEYCLOAK_DB_PASSWORD = 'changeme'

NUXT_API_TOKEN = "badToken"
NUXT_PUBLIC_DEBUG = "false"
NUXT_PUBLIC_COLLECTIVO_URL = "http://localhost:3000"

NUXT_KEYCLOAK_ADMIN_CLIENT = "admin-cli"
NUXT_KEYCLOAK_ADMIN_SECRET = "**********"
NUXT_PUBLIC_KEYCLOAK_URL = "http://keycloak:8080"
NUXT_PUBLIC_KEYCLOAK_REALM = "collectivo"

NUXT_DIRECTUS_ADMIN_EMAIL = "[email protected]"
NUXT_DIRECTUS_ADMIN_PASSWORD = "d1r3ctu5"
NUXT_PUBLIC_DIRECTUS_URL = "http://localhost:8055"
KEYCLOAK_DOMAIN = "keycloak"
KEYCLOAK_ADMIN = "[email protected]"
KEYCLOAK_ADMIN_PASSWORD = "admin"
KEYCLOAK_DB_PASSWORD = "changeme"
KEYCLOAK_REALM = "collectivo"
KEYCLOAK_ADMIN_CLIENT = "admin-cli"
KEYCLOAK_ADMIN_SECRET = "**********"
KEYCLOAK_DIRECTUS_CLIENT = "directus"
KEYCLOAK_DIRECTUS_SECRET = "**********"

COLLECTIVO_URL = "http://localhost:3000"
COLLECTIVO_DOMAIN = "localhost"
COLLECTIVO_DEBUG = "false"
COLLECTIVO_API_URL = "http://host.docker.internal:3000"
COLLECTIVO_API_TOKEN = "badToken"
18 changes: 9 additions & 9 deletions collectivo/collectivo/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ export default defineNuxtConfig({
ssr: false,
runtimeConfig: {
collectivoVersion: pkg.version,
apiToken: "badToken",
directusAdminEmail: "[email protected]",
directusAdminPassword: "d1r3ctu5",
keycloakAdminClient: "admin-cli",
keycloakAdminSecret: "**********",
apiToken: process.env.COLLECTIVO_API_TOKEN || "badToken",
directusAdminEmail: process.env.DIRECTUS_ADMIN_EMAIL || "[email protected]",
directusAdminPassword: process.env.DIRECTUS_ADMIN_PASSWORD || "d1r3ctu5",
keycloakAdminClient: process.env.KEYCLOAK_ADMIN_CLIENT || "admin-cli",
keycloakAdminSecret: process.env.KEYCLOAK_ADMIN_SECRET || "**********",
public: {
debug: false,
collectivoUrl: "http://localhost:3000",
collectivoUrl: process.env.COLLECTIVO_URL || "http://localhost:3000",
authService: "keycloak",
keycloakUrl: "http://keycloak:8080",
keycloakRealm: "collectivo",
directusUrl: "http://localhost:8055",
keycloakUrl: process.env.KEYCLOAK_URL || "http://keycloak:8080",
keycloakRealm: process.env.KEYCLOAK_REALM || "collectivo",
directusUrl: process.env.DIRECTUS_URL || "http://localhost:8055",
},
},
colorMode: {
Expand Down
55 changes: 28 additions & 27 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ services:
directus-db:
condition: service_healthy
environment:
KEY: "0fda9121-269d-44bd-91f2-4ff05be14b4b"
SECRET: "86cb4a76-a4c6-4ce7-8181-b0445d95675c"
PUBLIC_URL: ${DIRECTUS_URL}
KEY: ${DIRECTUS_KEY}
SECRET: ${DIRECTUS_SECRET}

ADMIN_EMAIL: ${NUXT_DIRECTUS_ADMIN_EMAIL}
ADMIN_PASSWORD: ${NUXT_DIRECTUS_ADMIN_PASSWORD}
ADMIN_EMAIL: ${DIRECTUS_ADMIN_EMAIL}
ADMIN_PASSWORD: ${DIRECTUS_ADMIN_PASSWORD}

CORS_ENABLED: "true"
CORS_ORIGIN: "true"
Expand All @@ -38,16 +39,13 @@ services:
CACHE_STORE: "redis"
REDIS: "redis://directus-cache:6379"

PUBLIC_URL: "http://localhost:8055"

AUTH_PROVIDERS: "keycloak"
AUTH_KEYCLOAK_DRIVER: "openid"
AUTH_KEYCLOAK_CLIENT_ID: "directus"
AUTH_KEYCLOAK_CLIENT_SECRET: "**********"
AUTH_KEYCLOAK_ISSUER_URL: "http://keycloak:8080/realms/collectivo/.well-known/openid-configuration"
AUTH_KEYCLOAK_CLIENT_ID: ${KEYCLOAK_DIRECTUS_CLIENT}
AUTH_KEYCLOAK_CLIENT_SECRET: ${KEYCLOAK_DIRECTUS_SECRET}
AUTH_KEYCLOAK_ISSUER_URL: "${KEYCLOAK_URL}/realms/collectivo/.well-known/openid-configuration"
AUTH_KEYCLOAK_IDENTIFIER_KEY: "email"
AUTH_KEYCLOAK_ALLOW_PUBLIC_REGISTRATION: "true"
# AUTH_KEYCLOAK_DEFAULT_ROLE_ID:

SESSION_COOKIE_SECURE: "false"
SESSION_COOKIE_SAME_SITE: "lax"
Expand All @@ -57,10 +55,13 @@ services:
EMAIL_FROM: ${DIRECTUS_EMAIL_FROM}
EMAIL_TRANSPORT: ${DIRECTUS_EMAIL_TRANSPORT}
EMAIL_SMTP_HOST: ${DIRECTUS_EMAIL_SMTP_HOST}
EMAIL_SMTP_PORT: ${DIRECTUS_EMAIL_SMTP_PORT}
EMAIL_SMTP_USER: ${DIRECTUS_EMAIL_SMTP_USER}
EMAIL_SMTP_PASSWORD: ${DIRECTUS_EMAIL_SMTP_PASSWORD}

COLLECTIVO_API_URL: ${COLLECTIVO_API_URL}
COLLECTIVO_API_KEY: ${COLLECTIVO_API_TOKEN}
FLOWS_ENV_ALLOW_LIST: "COLLECTIVO_API_URL, COLLECTIVO_API_TOKEN"

directus-db:
image: postgis/postgis:15-3.4-alpine
volumes:
Expand All @@ -80,20 +81,6 @@ services:
directus-cache:
image: redis:6

keycloak-db:
image: postgres:15.4-alpine
volumes:
- keycloak-db-data:/var/lib/postgresql/data
environment:
POSTGRES_DB: keycloak
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: ${KEYCLOAK_DB_PASSWORD}
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5

keycloak:
build:
context: ./keycloak
Expand All @@ -109,13 +96,13 @@ services:
KC_DB_URL_DATABASE: "keycloak"
KC_DB_URL_HOST: "keycloak-db"
KC_DB_URL_PORT: 5432
KC_HOSTNAME: ${KEYCLOAK_HOSTNAME}
KC_HOSTNAME: ${KEYCLOAK_DOMAIN}
volumes:
- ./keycloak/import:/opt/keycloak/data/import:ro
- ./keycloak/export:/tmp/export
command: start-dev --import-realm --health-enabled true
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health/ready"]
test: ["CMD", "curl", "-f", "${KEYCLOAK_URL}/health/ready"]
interval: 5s
timeout: 5s
retries: 20
Expand All @@ -124,6 +111,20 @@ services:
ports:
- "8080:8080"

keycloak-db:
image: postgres:15.4-alpine
volumes:
- keycloak-db-data:/var/lib/postgresql/data
environment:
POSTGRES_DB: keycloak
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: ${KEYCLOAK_DB_PASSWORD}
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5

volumes:
directus-db-data:
keycloak-db-data:
Loading