Skip to content

Discuss: Order of precedence for program argument values #627

@jaridmargolin

Description

@jaridmargolin

The Problem

The current order of precedence for resolving arguments is as follows:

  1. CLI flags
  2. Config file (if configured)
  3. Env var (if configured)
  4. Default values (if configured)

I wanted to start an active discussion around the possibility of swapping the order of precedence for config files and env vars (or less favorably, offering a way to configure the order of precedence):

  1. CLI flags
  2. Env var (if configured)
  3. Config file (if configured)
  4. Default values (if configured)

Why

Precedence... I believe there is already and standard and understood order of precedence in the community. I also believe consistency is paramount. When picking up a tool the less domain knowledge I need have to know the better.

Notable examples:

  1. npm - The package manager for JavaScript
  2. aws - A unified tool that provides a consistent interface for interacting with all parts of AW
  3. docker - Docker is the world's leading software containerization platform
  4. ansible - An IT automation tool
  5. git - A distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
  6. viper - Viper is a complete configuration solution for go applications including 12 factor apps

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions