Skip to content

Conversation

belak
Copy link

@belak belak commented Jun 3, 2018

When I started experimenting with gopass I was getting frustrated with having a pager open when I didn't want it to, so I tried setting it in a config file. However, it looks like these values were being ignored because they never made it into the app context.

This loads all config values into the app context which have an available helper in ctxutil.

@codecov-io
Copy link

Codecov Report

Merging #833 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #833      +/-   ##
==========================================
+ Coverage    64.3%   64.33%   +0.04%     
==========================================
  Files         170      170              
  Lines        9621     9631      +10     
==========================================
+ Hits         6186     6196      +10     
  Misses       2675     2675              
  Partials      760      760
Impacted Files Coverage Δ
context.go 80.65% <100%> (+9.22%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 64b7266...ddc5b30. Read the comment docs.

Copy link
Member

@dominikschulz dominikschulz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for your PR, unfortunately this will break the config handling. Usually the appropriate config options should be set for a sub store by calling config.WithContext which will only override config options not already set. If you now set the root store options here it will always overwrite any sub-store specific config options.

@belak
Copy link
Author

belak commented Jun 3, 2018

I'm curious what this breaks since the config itself will already be set or have the default values at this point and this only sets values which come from the config. Where would sub-stores be overriding config values?

@dominikschulz
Copy link
Member

The WithContext method of a sub store config will only overwrite context values which weren't set before. This would break if you'd populate these with the root store confiy

@belak
Copy link
Author

belak commented Jun 3, 2018

I guess my confusion is that the first thing done in app.go is that config.Load() is called so if I'm understanding this right, all the config values here should be their final values. Are config values overridden elsewhere in the code?

@belak belak mentioned this pull request Jun 3, 2018
@belak
Copy link
Author

belak commented Jun 3, 2018

For context, I was aiming to solve #838 with this PR (which I admittedly filed after this PR). This seemed like the right fix because the config is currently passed into initContext but never actually used.

@dominikschulz
Copy link
Member

Yes ... it's a fair approach, but I don't think this one will work. Let's see if we can find a proper solution in #838

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants