Commit Graph

344 Commits

Author SHA1 Message Date
Mark Sagi-Kazar
8b7fbcaa4b Fix golint 2019-12-06 13:00:52 +01:00
Mark Sagi-Kazar
29bb3ee94f Fix deadcode 2019-12-06 13:00:52 +01:00
Mark Sagi-Kazar
7b5adba788 Fix whitespace 2019-12-06 13:00:52 +01:00
Mark Sagi-Kazar
cea8b9dfcd Fix goimports 2019-12-06 13:00:52 +01:00
Mark Sagi-Kazar
e316012b4d Fix gofmt 2019-12-06 13:00:52 +01:00
Mark Sagi-Kazar
78a0e37a24 Add github actions workflow 2019-12-06 12:35:47 +01:00
Mark Sagi-Kazar
fae3a81867 Add ide integration 2019-12-06 12:10:03 +01:00
Mark Sagi-Kazar
d52c544291 Add Makefile 2019-12-06 12:10:03 +01:00
Mark Sagi-Kazar
abdeaff171 Add golangci config 2019-12-06 12:10:03 +01:00
Mark Sagi-Kazar
8feab54f0e Tidy dependencies 2019-12-06 11:22:37 +01:00
Matti R
351bfe9719 loop through ini sections
pass tests

write out ini file & tests

go fmt

Update viper_test.go
fix test

gofmt
2019-12-06 09:02:54 +01:00
javaducky
3a19b6e0d9 Review updates to utilize afero for file checks and updated checks on unit tests 2019-12-06 08:36:52 +01:00
javaducky
a708479794 Updating SafeWriteConfig and SafeWriteConfigAs to match documented behavior.
Methods should throw an error if the config file already exists or if no configpath is configured when not explicitly requesting a write path.
2019-12-06 08:36:52 +01:00
Benoit Masson
9e353e395e find() looks for flag's default values only when requested.
Default value should be looked for by Get(), but not by IsSet().

This logic should remain inside find(), to make sure that shadowing
of keys is handled properly.

Fixes Issue #276.
2019-11-29 21:16:13 +01:00
Benoit Masson
4e1ebbdaba Added tests to TestIsSet()
Added tests for:
- nested elements
- environment values
- flags (currently fails => IsSet() always returns true,
                            due to the default value of the flag)
2019-11-29 21:16:13 +01:00
Kévin Dunglas
01d7d76eb0 Add Mercure in the list of projects using Viper 2019-11-08 13:18:39 +01:00
Pedro Silva
d1c60d9e69 Support config files with no extensions (#722)
* Support config files with no extensions

* Update README informing config files without extension are supported
2019-11-06 14:54:13 +01:00
Vivek V
72b022eb35 Added capacity to slice creation 2019-11-01 11:15:09 +01:00
Navid Shaikh
40e41dd224 Updates YAML to v2.2.4
Make sure we're not vulnerable to CVE-2019-11253.
See https://github.com/kubernetes/kubernetes/issues/83253
2019-10-16 10:29:20 +02:00
Mark Sagi-Kazar
71509d2887 Revert the effective changes of #673 2019-09-28 12:02:57 +02:00
Mark Sagi-Kazar
398adc5a7d Add breaking test that requires reverting #673 2019-09-28 12:02:57 +02:00
Mark Sagi-Kazar
371f39c3ab Add Go 1.13 to travis 2019-09-27 23:35:02 +02:00
Mark Sagi-Kazar
c171232d3a Add go version to the mod file 2019-09-27 23:35:02 +02:00
Lars Lehtonen
583f79b3ea remote: fix two dropped errors 2019-09-27 21:42:20 +02:00
inkychris
99520c81d8 Implemented ability to unmarshal keys containing dots to structs.
Changed formatting of test objects for better git diffing and readibility.
Fixed failing tests on Windows.
2019-09-11 16:03:08 +02:00
Mark Sagi-Kazar
bd1db6bb8c Run go mod tidy 2019-08-29 15:42:25 +02:00
TwiN
e697d557b7 Fix small typo 2019-08-17 00:18:41 +02:00
Christian Muehlhaeuser
33bf76add3 Simplify code
Removed unnecessary conversions.
2019-07-29 18:37:00 +02:00
Christian Muehlhaeuser
1b33e8258e Add error handling
Added error handling around ineffectual err assignments. Please review
thoroughly.
2019-07-28 14:50:13 +02:00
Christian Muehlhaeuser
d65fa7608b Fixed typo
Just a nitpicky typo fix.
2019-07-28 14:47:04 +02:00
Rodrigo Chiossi
cdccc8152c Fix SafeWriteConfig
If the config file does not exist and the force flag is not set,
OpenFile would not use O_CREATE flag, causing viper to fail with
error "File not exist" and to not create the config file.
This patch changes the behavior of writeConfig() so that if force is set
to false, OpenFile will use O_EXCL flag, thus failing if the file
already exists or creating a new file otherwise.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2019-07-28 12:33:29 +02:00
bpizzi
e02bc9eca5 Fixed missing f.Close() in writeConfig()
Defering can cause trouble because we're writing to the file outside the function
where the defering is registered, calling f.Sync() ensures that bytes are flushed
to disk even is Close() is called too soon.
2019-07-13 12:28:02 +02:00
Nicolas Martin
e325492b82 Add missing call to initWF.Done() 2019-07-13 12:13:30 +02:00
Márk Sági-Kazár
e6d1c6bc9a Improve godoc 2019-07-13 12:11:16 +02:00
CodeLingo Bot
275a36d0a0 Fix function comments based on best practices from Effective Go
Signed-off-by: CodeLingo Bot <bot@codelingo.io>
2019-07-13 12:11:16 +02:00
Márk Sági-Kazár
7fdad0204e Fix typo 2019-07-13 12:04:36 +02:00
AGirard
b8221cf4ee Add GetIntSlice helper method 2019-07-13 12:04:36 +02:00
Márk Sági-Kazár
72cbe340cb Improve travis 2019-07-13 11:53:30 +02:00
lucperkins
5ae3a072d1 Add documentation for no config file found
Signed-off-by: lucperkins <lucperkins@gmail.com>
2019-07-13 11:37:02 +02:00
Márk Sági-Kazár
d34be8d9ee Improve BindEnv details 2019-07-13 11:35:03 +02:00
Bruce Wang
96441b4b74 BindEnv details specified. Now less confusion. 2019-07-13 11:35:03 +02:00
victor23d
2b4f7d3cde Add dotenv documentation in README.md 2019-07-13 11:28:35 +02:00
Márk Sági-Kazár
3349bd9cc2 Improve Unmarshal docs (#713)
Closes #589
Closes  #588
2019-06-14 11:17:12 -04:00
okazu-dm
3b4aca7571 Fix example code
Unmarshal -> viper.Unmarshal
2019-06-13 10:51:37 +02:00
liubog2008
b235f72abb fix(leak): fix leak in dependency magiconair/properities 2019-06-11 23:33:57 +02:00
Alpha
fde59dd3e4 ADD: installation method (#604)
* ADD: installation method

* Update README.md
2019-06-11 16:58:53 -04:00
Pawan Rawal
0c777cfac1 Fix indentation for yamlStringSettings (#651)
The indentation seemed messed up and didn't read well. This change fixes it.
2019-06-11 16:53:59 -04:00
Márk Sági-Kazár
ad5ed02fa4 Add support for int slice flags (#637)
* Add support for int slice flags

* Add int slice test to unmarshal
2019-06-11 16:51:57 -04:00
EmilLuta
0da4d41b2d Add WriteConfig documentation (#649) 2019-06-11 16:51:04 -04:00
0xflotus
a52795991d fixed marshal (#647) 2019-06-11 16:50:29 -04:00