Skip to content

bug: Environment settings override CTL configuration file when specifying the file #1254

Description

@ogenstad

Component

infrahubctl

Infrahub SDK version

1.22.2

Current Behavior

When you are using infrahubctl and specifically point to a configuration toml file environment variables can override the settings from the tomlfile.

Example:

infrahubctl transform --config-file=infrahub_prod.toml device_config_transform device=router1 --branch=main

Contents of infrahub_prod.toml

server_address = "https://infrahub.example.com/"
api_token = "xyz"

You also have a local environment variable where INFRAHUB_ADDRESS=http://localhost:8000.

In this case infrahubctl will try to connect to the localhost.

Expected Behavior

Since the user specifically used the --config-file option that setting should win.

Steps to Reproduce

Check the current behaviour section

Additional Information

A consideration here though is that the default argument for --config-file is "infrahub.toml", and there's a scenario where the file is just silently found. It's not clear which setting should win in that case the config file or the environment variable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions