Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FilePath does not take precedence over EnvVar #1866

Closed
zc-devs opened this issue Feb 17, 2024 · 0 comments
Closed

FilePath does not take precedence over EnvVar #1866

zc-devs opened this issue Feb 17, 2024 · 0 comments
Labels
area/v2 relates to / is being considered for v2 kind/bug describes or fixes a bug status/triage maintainers still need to look into this

Comments

@zc-devs
Copy link

zc-devs commented Feb 17, 2024

My urfave/cli version is v2.27.1

Dependency Management

  • I am unsure of what my dependency management setup is.

Describe the bug

FilePath does not take precedence over EnvVar as described in documentation.

To reproduce

  1. Set some flag
&cli.StringFlag{
	EnvVars:  []string{"WOODPECKER_DATABASE_DATASOURCE"},
	Name:     "datasource",
	Usage:    "database driver configuration string",
	Value:    "woodpecker.sqlite",
	FilePath: os.Getenv("WOODPECKER_DATABASE_DATASOURCE_FILE"),
},
  1. Set EnvVar:
export WOODPECKER_DATABASE_DATASOURCE=/var/lib/woodpecker/woodpecker.sqlite
  1. Set FilePath variable:
export WOODPECKER_DATABASE_DATASOURCE_FILE=/run/secrets/woodpecker-datasource.conf
  1. Get /var/lib/woodpecker/woodpecker.sqlite instead /run/secrets/woodpecker-datasource.conf in datasource flag.

Observed behavior

Step 4.

Expected behavior

FilePath should take precedence over EnvVar. So, I should get /run/secrets/woodpecker-datasource.conf in datasource flag.

Additional context

woodpecker-ci/woodpecker#3389

@zc-devs zc-devs added area/v2 relates to / is being considered for v2 kind/bug describes or fixes a bug status/triage maintainers still need to look into this labels Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/v2 relates to / is being considered for v2 kind/bug describes or fixes a bug status/triage maintainers still need to look into this
Projects
None yet
Development

No branches or pull requests

2 participants