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

'hugo config' does not respect '--environment' swtch #6503

Closed
frerich opened this issue Nov 12, 2019 · 5 comments · Fixed by #6834
Closed

'hugo config' does not respect '--environment' swtch #6503

frerich opened this issue Nov 12, 2019 · 5 comments · Fixed by #6834
Assignees
Milestone

Comments

@frerich
Copy link

frerich commented Nov 12, 2019

What version of Hugo are you using (hugo version)?

$ hugo version
Hugo Static Site Generator v0.59.1/extended darwin/amd64 BuildDate: unknown

Does this issue reproduce with the latest release?

Yes.

How To Reproduce

  1. Create a new project:

    $ hugo new site sample
    [...]
    $ cd sample
    
  2. Create two configuration files for two environments; define the same param key in each configuration file:

    $ mkdir -p config/production config/myenv
    $ cat > config/production/config.toml << EOF
    [params]
    mysetting = "production_value"
    EOF
    $ cat > config/myenv/config.toml << EOF
    [params]
    mysetting = "myenv_value"
    EOF
    
  3. Use hugo config to get the value of the mysetting parameter in the myenv environment:

    $ hugo config --environment myenv | grep mysetting
    

Expected Behaviour

Print just one line indicating that the mysetting parameter assumed the value myenv_value.

Observed Behaviour

A line is printed giving the value of the mysetting parameter as defined in the production environment:

params = map[mysetting:production_value]
@johnelliott
Copy link

I see this too. The config command also doesn't print the same values that are used when the build runs. For example hugo -e staging config contains the incorrect baseURL used in generating the build output for that environment when running hugo -e staging.

@frerich
Copy link
Author

frerich commented Nov 28, 2019

For what it's worth, I can reproduce this in Hugo v0.60.0, too.

@samvdb
Copy link

samvdb commented Jan 21, 2020

Issue is also present in Hugo Static Site Generator v0.62.2-83E50184/extended linux/amd64 BuildDate: 2020-01-05T18:57:23Z

@zbayoff
Copy link
Contributor

zbayoff commented Jan 29, 2020

having the same issue on Hugo Static Site Generator v0.63.1-CE9ACEB7 darwin/amd64 BuildDate: 2020-01-23T20:10:12Z

@bep bep added the Bug label Jan 31, 2020
@bep bep self-assigned this Jan 31, 2020
@bep bep added this to the v0.64 milestone Jan 31, 2020
bep added a commit to bep/hugo that referenced this issue Jan 31, 2020
bep added a commit to bep/hugo that referenced this issue Jan 31, 2020
bep added a commit to bep/hugo that referenced this issue Jan 31, 2020
bep added a commit to bep/hugo that referenced this issue Jan 31, 2020
bep added a commit to bep/hugo that referenced this issue Jan 31, 2020
@bep bep closed this as completed in #6834 Jan 31, 2020
bep added a commit that referenced this issue Jan 31, 2020
@github-actions
Copy link

github-actions bot commented Feb 8, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants