Commit graph

623 commits

Author SHA1 Message Date
Chris Hamant
1b8adf4854 fixing problem with case sensitivity with keys in env and flags maps 2014-10-09 16:39:24 -04:00
Chris Hamant
01b1780288 adding simple test for BindPFlag 2014-10-09 15:52:49 -04:00
spf13
83fd92627c Adding automatic reading from ENV w/tests 2014-09-27 14:05:01 -07:00
spf13
aacc3049e2 Adding AllKeys and AllSettings functions and tests 2014-09-27 14:05:01 -07:00
spf13
181a3b5f3b Adding support for ENV variables 2014-09-27 14:04:50 -07:00
David Pelaez
d56c59c66a Included .yml as supported extension.
Hi. Thanks for creating Viper, it's been very useful to me. I come from Ruby and .yaml is really never used there, .yml is the common extension. I verified online and it's valid known extension for Yaml files so I added it. I realized this when trying to use `config.yml` in a project and getting an error on my code. Does adding this makes sense? Pretty silly addition, but it did confuse me for a while to realize the error using my app on a server, so I think it's worth adding. Cheers.
2014-09-08 12:03:29 -04:00
Nate Finch
2b24bea958 fix issue #8
This fixes the aliases in config files bug.  Whenever we register an alias, if there is a value in
the config (or defaults or override) for the alias, we move that value to the new "real key".

Added a test for the bug, which fails without the changes and passes with the changes.

This also fixes a bug in Hugo, where specifying "Taxonomies" in your config file doesn't get recognized,
because Hugo aliases "Taxonomies" to "Indexes" which means that when the code does a Get("Taxnomies") it
got translated to Get("Indexes"), which didn't exist in the original config map.
2014-08-06 00:27:39 -04:00
Nate Finch
3cf05f93ef fix test after function rename 2014-08-06 00:24:36 -04:00
spf13
38c6d9eca3 Better comments for go doc 2014-07-11 10:42:07 -04:00
spf13
c5a9056e3b Better naming of the Marshal functionality. 2014-07-11 10:41:45 -04:00
spf13
1cebee8d97 Better binding to Pflag 2014-07-11 10:28:03 -04:00
spf13
7c42740ea6 Adding the ability to bind a flag to a key. Will set the default & override automatically.
Use like:
	fetchCmd.Flags().Int("rsstimeout", 5, "Timeout (in min) for RSS retrival")
	viper.BindPFlag("rsstimeout", fetchCmd.Flags().Lookup("rsstimeout"))
2014-06-27 12:29:37 -04:00
spf13
af373af72c Adding the ability to get into a struct 2014-06-26 17:58:55 -04:00
spf13
7f5b583ff1 Handle $HOME and other environment variables in paths 2014-06-25 17:23:00 -04:00
spf13
541c1f8c59 Fixing case sensitivity bug with override values 2014-05-29 16:48:24 -04:00
Victor Castell
16d5c7c27d Add support for yml extension 2014-05-09 23:28:57 -04:00
Joshua Rubin
1a2e68e1bc return more useful error if config file is missing
Signed-off-by: Joshua Rubin <jrubin@zvelo.com>
2014-04-10 14:15:39 -04:00
spf13
25817ada59 Added Reset Function 2014-04-07 23:35:53 -04:00
spf13
8b744a9310 Added "ConfigFileUsed" function 2014-04-07 23:35:40 -04:00
spf13
a54c415b55 Adding first draft of README. 2014-04-05 15:44:26 -04:00
spf13
bcb02e2472 Viper is now case insensitive 2014-04-05 01:19:39 -04:00
spf13
98be0718d2 Initial Version 2014-04-04 17:21:59 -04:00
Steve Francia
f98d9bf08b Initial commit 2014-04-02 07:33:33 -07:00