g10k icon indicating copy to clipboard operation
g10k copied to clipboard

Support a config file

Open alex-harvey-z3q opened this issue 7 years ago • 7 comments

It would be great if this tool supported a config file at somewhere like ~/.g10k/config.yml. My immediate use-case is that I want to move the cachedir on my development laptop only, perhaps to /var/tmp/g10k because /tmp is cleaned every time the machine is booted. It looks like while I could specify an alternate cache dir on the command line, that's not ideal because I would need to either change it in the code which is also used in the CI system, or remember to type it each time I run g10k.

alex-harvey-z3q avatar Aug 31 '17 01:08 alex-harvey-z3q

Sure, I'll look into it.

In the meantime you could use an alias on your dev laptop that uses a different cachedir

Something like:

alias g10k="g10k -cachedir /tmp/foobar"

xorpaul avatar Aug 31 '17 08:08 xorpaul

Maybe another potential workaround would be using an overridable environment variable to specify the cachedir.

jovrum avatar Sep 01 '17 09:09 jovrum

There's already

g10k_cachedir=./tmp

, but that is only available in puppetfile mode.

I can also add that to the config mode.

xorpaul avatar Sep 01 '17 09:09 xorpaul

So, I just run:

export g10k_cachedir=/var/tmp

And that will be my cachedir when I later run:

g10k -puppetfile

?

If so, that's perfect.

Maybe mention this awesomeness in the README?

alex-harvey-z3q avatar Sep 01 '17 09:09 alex-harvey-z3q

Yep, that should do what you want, if you're only using the puppetfile mode.

I'm also not sure why this feature hasn't made it to the README :thinking:

xorpaul avatar Sep 01 '17 10:09 xorpaul

I added a hint to the README. The environment variable g10k_cachedir can now also override the :cachedir setting from the g10k YAML config and also takes precedence over the -cachedir CLI parameter.

https://github.com/xorpaul/g10k/releases/tag/v0.3.12

Can you think of another reason a special config file would be helpful or can I close this issue?

xorpaul avatar Sep 01 '17 15:09 xorpaul

I suppose if there is just one parameter to set, environment variables are fine, whereas if you had to set a few of these parameters, then a config file probably would make sense. Right now, an environment variable is perfect for me.

alex-harvey-z3q avatar Sep 01 '17 15:09 alex-harvey-z3q