feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
15.07k stars 752 forks source link

V5 .env variables not present #2964

Closed k-flynn-webdev closed 1 year ago

k-flynn-webdev commented 1 year ago

Steps to reproduce

I've looked in the new guides and the node_config but I can't find a solution (hopefully just a mis-read)

I want to override the default.json with some variables from a .env file in the root of the project. So far i've had no luck i'm assuming the .env is not actually read? I've tried using the .env variable name as a value in both the default.json and custom-enviroment-variables.json but no joy the value never matches the .env file.

My use case is replacing the port and host values with a .env file thats shared between docker setups as well as for local running.

Expected behavior

.env file to be used as an override for the node_config

Actual behavior

.env file values do NOT override the node_config

System configuration

V5 featherjs brand new generated project

k-flynn-webdev commented 1 year ago

Solved by updated my docker file with a -env node_config=xxx


    build: .
    image: node-app
    container_name: node-app-dev
    ports:
      - '${PORT}:${PORT}'
    environment:
      - NODE_CONFIG={ "host":"${HOST}", "port":${PORT}, "postgresql":{ "client":"pg", "connection":"postgres://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}"} }
    depends_on:
      - database-layer
    volumes:
      - .:/usr/src/node-app
    networks:
      - shared-network
    restart: on-failure```
k-flynn-webdev commented 1 year ago

I now have a working V5 docker project. See above comment.