Commit Graph

364 Commits

Author SHA1 Message Date
Kiril Zvezdarov 2e2f3b2643 Marshal now gets the map via the AllSettings method
Conflicts:
	viper.go
2015-03-12 22:33:19 -04:00
Kiril Zvezdarov 700eefa74b Exported the Viper type in order to better support multiple Vipers
Conflicts:
	viper.go
2015-03-12 22:27:14 -04:00
Daniel Eloff e133904c4f Add GetSizeInBytes.
Useful to parse strings like 1GB or 12 mb into an unsigned integer number of bytes.
2015-03-12 22:19:13 -04:00
Anthony Fok 5b0b926e3d :%s/insensativiseMap/insensitiviseMap/g 2015-03-07 04:04:19 -07:00
Anthony Fok 8b99f53550 Avoid searching for config file in executable's path
Viper should not be searching for config.{json,toml,yaml,yml}
in the directory where the `hugo` executable binary is located,
i.e. do not try to look for e.g. $GOPATH/bin/config.toml or
/usr/local/bin/config.toml
2015-03-07 04:01:22 -07:00
Anthony Fok 0c5f3e2462 Minor revisions to README.md
* Change the order to "JSON, TOML and YAML" because that is
   the order that Viper attempts to find the config file,
   as listed in SupportedExts string array

 * Rename "Indexes" to "Taxonomies" (re: Hugo)

 * GitHub now forces https, so update GitHub URLs accordingly

 * Add links to Wikipedia pages about Viper and Cobra Commander
   in case the users do not know the G.I. Joe reference

 * Other minor copyediting
2015-03-07 03:52:13 -07:00
Chance Zibolski 1258332127 Fix whitespace 2015-03-06 11:21:50 -08:00
Chance Zibolski 03fb74b5d7 Support rewriting env keys 2015-03-06 11:21:17 -08:00
Chance Zibolski ededa04e0b Add viper.GetDuration 2015-03-06 10:11:47 -08:00
Ross Cooperman 90734830d1 Move viper.Reset() back to the public interface
It is helpful for applications that use viper to be able to
reset their configurations between test runs.
2015-02-24 11:54:15 -05:00
spf13 6c5a915341 adding more env tests 2015-02-16 23:32:10 -05:00
Anthony Fok 82cbb7dec7 Upgrade from gopkg.in/yaml.v1 to gopkg.in/yaml.v2 2015-02-16 19:32:47 -05:00
spf13 d8f2aa78d4 More intelligent AutomaticEnv behavior and updated documentation. 2014-12-22 22:55:07 -05:00
spf13 54fed16054 Adding docs for SetEnvPrefix and cleaning up docs. 2014-12-22 21:45:56 -05:00
spf13 1022d75c73 Adding Support for Environment variable prefixes 2014-12-22 18:31:11 -05:00
kgv 2909239689 Change from Get(key) to v.Get(key) in GetXXX(key string) and MarshalKey(key string, rawVal interface{}) functions. 2014-12-09 08:29:33 -05:00
spf13 cacbc4c733 Rewriting the documentation 2014-12-07 02:03:49 +01:00
spf13 91b076eec5 MarshallReader -> marshalReader 2014-12-06 09:48:28 +01:00
spf13 18a87c05c6 Adding documentation inline. Moving Reset() to viper_test.go 2014-12-05 17:04:40 +01:00
spf13 29f1858f87 Viper now supports multiple vipers. No API changes. 2014-12-05 03:55:51 +01:00
Andrew Cohen 90193e564a Add travis ci support 2014-11-13 16:36:34 -05:00
Andrew Cohen 5aa1437cf3 Fix missed path->filepath renaming
This fixes https://github.com/spf13/viper/issues/24

Caused by https://github.com/spf13/viper/pull/20
2014-11-13 16:23:17 -05:00
Steve Francia 64816e4860 Merge pull request #21 from cudevmaxwell/typo
Fixed typo
2014-11-12 16:54:00 -05:00
Steve Francia 4dcc7d4916 Merge pull request #20 from mohae/fix-windows-path
update to consistently use filepath instead of path and add looking in o...
2014-11-12 16:53:34 -05:00
Kevin Bowrin 6c340f2886 Fixed typo 2014-11-07 18:14:27 +00:00
Joel Scoble 22f85e27c4 update to consistently use filepath instead of path and add looking in os.Getwd() for the config file to fix finding the config file in Windows issue 2014-11-05 18:23:02 -06:00
Steve Francia 77144270da Merge pull request #18 from stp-ip/patch-1
Fix typo
2014-10-29 07:51:07 -04:00
Michael Grosser bddcf7e104 Fix typo 2014-10-29 07:43:14 +01:00
Steve Francia 22d0391e9b Merge pull request #17 from bketelsen/etcd-consul-crypt
Etcd consul crypt
2014-10-28 22:22:49 -04:00
Brian Ketelsen 0562ef4c8b merge upstream/master 2014-10-28 22:09:30 -04:00
Brian Ketelsen e55c96ecc9 document consul support, not requirement to set config type for remote KV stores 2014-10-27 21:53:22 -04:00
Brian Ketelsen 563f4d44c4 add support for consul 2014-10-27 21:14:46 -04:00
Brian Ketelsen 51da30f655 Added basic documentation, pointers to crypt repository, and tests for precedence 2014-10-27 15:32:46 -04:00
Steve Francia 779adc021a Merge pull request #13 from chrishamant/master 2014-10-27 14:35:35 -04:00
Brian Ketelsen 5e1d5e7207 removing some debugging printlns 2014-10-27 12:21:03 -04:00
Brian Ketelsen ea04102003 Actually return the kvstore retrieved from the kv server 2014-10-27 11:06:20 -04:00
Brian Ketelsen d2d8f6caa1 added error for remote configuration not found 2014-10-27 11:03:11 -04:00
Brian Ketelsen c33e690687 add readremoteconfig for cases when there are no local configuration files 2014-10-27 10:14:45 -04:00
Brian Ketelsen f8939d9229 existing tests pass 2014-10-26 09:48:21 -04:00
Brian Ketelsen a28bee1fba adding preliminary etcd support 2014-10-26 09:42:03 -04:00
Brian Ketelsen 3d8182460c work in progress 2014-10-24 15:38:01 -04:00
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