Skip to content

How to configure CORS in docker environment variables #608

@pasquy73

Description

@pasquy73

I'm using STH-Comet in a docker-compose yaml file and have CORS issues. Here is an extract of yaml file (I'm using .env file too):

  sth-comet:
    image: fiware/sth-comet:${STH_COMET_VERSION}
    hostname: sth-comet
    container_name: fiware-sth-comet
    restart: always
    depends_on:
      - database-mongo
    networks:
      - monitoring-net
    ports:
      - ${STH_COMET_PORT}:${STH_COMET_PORT}
    environment:
      - STH_HOST=0.0.0.0
      - STH_PORT=${STH_COMET_PORT}
      - DB_PREFIX=sth_
      - DB_URI=database-mongo:${MONGO_DB_PORT}
      - LOGOPS_LEVEL=INFO

I want to enable CORS using environment variables like STH_HOST or DB_PREFIX.
I couldn't find the env var to set it from the documentation. Is it possible?
At the moment, I'm fixing the problem by simply copying the config.js file (within enabled: 'true' in config.cors) into the container in this way:

docker cp config.js <CONTAINER_ID>:/opt/sth

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions