question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested config values in setting arrays and objects don't have environment variables expanded

See original GitHub issue

Migrated from GitLab: https://gitlab.com/meltano/meltano/-/issues/3245

Originally created by @alxthm on 2022-02-15 09:06:57


Related to #2366

What is the current bug behavior?

I was having trouble using environment variables in the meltano.yml file, and it seems they are only supported for top-level configuration options.

If I define SOME_ENV_VAR=SOME_VALUE in the .env file and I write this configuration yaml:

plugins:
  extractors:
    - name: tap-spreadsheets-anywhere
      variant: ets
      pip_url: git+https://github.com/ets/tap-spreadsheets-anywhere.git
      config:
        test: $SOME_ENV_VAR
        tables:
          - path: $SOME_ENV_VAR
            name: my_table

Then this is the actual configuration used by meltano:

$ meltano config tap-spreadsheets-anywhere
{
  "tables": [
    {
      "path": "$SOME_ENV_VAR",
      "name": "my_table"
    }
  ],
  "test": "SOME_VALUE"
}

And the tables.path variable is not set.

What is the expected correct behavior?

The environment variable SOME_ENV_VAR should expend to SOME_VALUE in the tables array as well, and we should have:

$ meltano config tap-spreadsheets-anywhere
{
  "tables": [
    {
      "path": "SOME_VALUE",
      "name": "my_table"
    }
  ],
  "test": "SOME_VALUE"
}

Steps to reproduce

  • add the configuration above in meltano.yml
  • add the line SOME_ENV_VAR=SOME_VALUE to your .env file
  • see the result with meltano config tap-spreadsheets-anywhere

Relevant logs and/or screenshots

Please use code blocks (```) to format console output

Possible fixes

If you can, link to the line of code that might be responsible for the problem or suggest a fix

Further regression test

Ensure we automatically catch similar issues in the future

  • Write additional adequate test cases and submit test results
  • Test results should be reviewed by a person from the team

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
pnadolny13commented, Dec 1, 2022
1reaction
edgarrmondragoncommented, Nov 3, 2022

@aaronsteers object settings can be worked around by using the dot syntax, e.g. my.nested.setting and can expand environment variables that way. For example: https://github.com/meltano/sdk/issues/1073

Read more comments on GitHub >

github_iconTop Results From Across the Web

Override ASP.NET 5 Nested Configuration Using Environment ...
You can define/access environment variables with colons (or other special characters) in their names by enclosing the variable name in curly brackets:
Read more >
Define variables - Azure Pipelines | Microsoft Learn
System variables are set with their current value when you run the ... defined in a YAML are not visible in the pipeline...
Read more >
motdotla/dotenv: Loads environment variables from .env for ...
Override any environment variables that have already been set on your machine with values from your .env file. require('dotenv').config({ ...
Read more >
Variables - Serverless Framework
Variables allow users to dynamically replace config values in serverless.yml config. They are especially useful when providing secrets for your service to ...
Read more >
Configuration | NestJS - A progressive Node.js framework
We could try to solve the problem of multiple environments by setting the environment variables separately in each environment. This can quickly get...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found