Environment variable interpolation

I have set my environment variables as depicted in the following photo:


Also, the following is my config.yml file

version: 2.1
jobs:
  build:
    parameters:
      db_user:
        type: env_var_name
        default: TEST_DB_USERNAME
      db_password: 
        type: env_var_name
        default: DB_PASSWORD
      test_db_name:
        type: env_var_name
        default: TEST_DB_NAME
    docker:
      # specify the version you desire here
      - image: circleci/node:11.6.0
        environment:
          NODE_ENV: test

      # setup test database
      - image: circleci/postgres:9.6.2-alpine
        environment:
          POSTGRES_USER: << parameters.db_user >>
          POSTGRES_DB: cmrc_db_test
          POSTGRES_PASSWORD: << parameters.db_password >>

    working_directory: ~/repo

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "package.json" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-

      - run: npm install

      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      # run tests!
      - run:
          name: Run Tests
          command: npm run ci:test

However, on trying to run my ci test, I keep getting the following error: error: database "cmrc_db_test" does not exist (line 841)
I know what causes the error, but I can’t find a way to remove the double quotes from the interpolated test_db_name (TEST_DB_NAME) variable.

I will appreciate your help, as all efforts in trying to resolve this are not yielding.

Oh! Thanks for pointing that out.

1 Like

I don’t have any view on it myself, but are you sure that the quote marks in the error are not just part of the error message, and are not in the env var value?