monacousa-portal/ENVIRONMENT_VARIABLES.md

2.7 KiB

Environment Variables Configuration

NocoDB Configuration (Required)

To fix API key issues and improve container deployment, set these environment variables in your Docker container:

Required Variables

# NocoDB Database Connection
NUXT_NOCODB_URL=https://database.monacousa.org
NUXT_NOCODB_TOKEN=your_actual_nocodb_api_token_here
NUXT_NOCODB_BASE_ID=your_nocodb_base_id_here

Alternative Variable Names (also supported)

# Alternative formats that also work
NOCODB_URL=https://database.monacousa.org
NOCODB_TOKEN=your_actual_nocodb_api_token_here
NOCODB_API_TOKEN=your_actual_nocodb_api_token_here
NOCODB_BASE_ID=your_nocodb_base_id_here

How to Set in Docker

Add to your docker-compose.yml:

services:
  monacousa-portal:
    image: your-image
    environment:
      - NUXT_NOCODB_URL=https://database.monacousa.org
      - NUXT_NOCODB_TOKEN=your_actual_nocodb_api_token_here
      - NUXT_NOCODB_BASE_ID=your_nocodb_base_id_here
    # ... rest of your config

Option 2: Docker Run Command

docker run -d \
  -e NUXT_NOCODB_URL=https://database.monacousa.org \
  -e NUXT_NOCODB_TOKEN=your_actual_nocodb_api_token_here \
  -e NUXT_NOCODB_BASE_ID=your_nocodb_base_id_here \
  your-image

Option 3: Environment File

Create .env file:

NUXT_NOCODB_URL=https://database.monacousa.org
NUXT_NOCODB_TOKEN=your_actual_nocodb_api_token_here
NUXT_NOCODB_BASE_ID=your_nocodb_base_id_here

Then use:

docker run --env-file .env your-image

Priority Order

The system will check configuration in this order:

  1. Environment Variables (highest priority)
  2. Admin Panel Configuration (fallback)
  3. Runtime Config (last resort)

Benefits

Container-Friendly: No need to configure through web UI Secure: API tokens stored as environment variables Reliable: No Unicode/formatting issues Version Control: Can be managed in deployment configs Scalable: Same config across multiple containers

Getting Your Values

NocoDB API Token

  1. Go to your NocoDB instance
  2. Click your profile → API Tokens
  3. Create new token or copy existing one
  4. Use the raw token without any formatting

NocoDB Base ID

  1. In NocoDB, go to your base
  2. Check the URL: https://your-nocodb.com/dashboard/#/nc/base/BASE_ID_HERE
  3. Copy the BASE_ID part

Testing Configuration

After setting environment variables, check the logs:

  • [nocodb] ✅ Using environment variables - URL: https://database.monacousa.org
  • [nocodb] ✅ Configuration validated successfully

If you see fallback messages, the environment variables aren't being read correctly.