bsideup / configo Goto Github PK
View Code? Open in Web Editor NEW12factor apps configuration manager
License: MIT License
12factor apps configuration manager
License: MIT License
See https://github.com/mitchellh/mapstructure
This will also provide some nice ways of handling configuration errors
We are using etcd for storing configuration parameters for different services and usually, in service files, we have lines like that
-e CONFIGO_SOURCE_30='{\"type\": \"etcd\", \"endpoints\": [\"http://${COREOS_PRIVATE_IPV4}:2379\"], \"prefix\": \"applications/worker-defaults/\"}' \
-e CONFIGO_SOURCE_40='{\"type\": \"etcd\", \"endpoints\": [\"http://${COREOS_PRIVATE_IPV4}:2379\"], \"prefix\": \"applications/worker/%i\"}' \
So most of these workers are fine with default parameters and we don't need to customize these settings, but we have to create empty dir /application/worker/something
and that is really annoying.
Is it possible to add one more configuration parameter like 'skipOnMissed' or something like that for nicer configuration?
We need auth by cert support. Like this auth https://user:[email protected]/config/app/profile/..., but by SSL certificate
Using SSL guarded resource example:
curl -k --key client.key --cert my_client_key.crt --url "https://myhost.com/config/app/profile"
Can ssl auth be implemented?
Hello,
I have a problem to get values from Vault:
Using vault client i have:
VAULT_TOKEN="s.7sd88sYp6pEEYSvGwHmWu5hI" vault kv get secret/helloworld
====== Metadata ======
Key Value
--- -----
created_time 2020-02-18T20:40:47.252174328Z
deletion_time n/a
destroyed false
version 1
====== Data ======
Key Value
--- -----
password foobarbazpass
username foobaruser
using configo:
$ export CONFIGO_SOURCE_0='{"type": "vault", "address": "https://vault.example.com", "token": "s.7sd88sYp6pEEYSvGwHmWu5hI", "path": "secret/helloworld"}'
apetrenko@T0111 in ~/Downloads/2020-08/18
$ ./configo.darwin-amd64 ls
panic: sync: inconsistent mutex state
goroutine 22 [running]:
sync.(*Mutex).Lock(0xc82009a000)
/usr/local/go/src/sync/mutex.go:74 +0x16d
math/rand.(*lockedSource).Int63(0xc82009a000, 0x77240)
/usr/local/go/src/math/rand/rand.go:239 +0x28
math/rand.(*Rand).Int63(0xc820092110, 0x611f5)
/usr/local/go/src/math/rand/rand.go:46 +0x39
math/rand.(*Rand).Int(0xc820092110, 0x0)
/usr/local/go/src/math/rand/rand.go:56 +0x21
math/rand.Int(0xc820036020)
/usr/local/go/src/math/rand/rand.go:183 +0x23
net.exchange(0xc820010300, 0xc, 0xc82013b050, 0x23, 0xc820010001, 0x12a05f200, 0x0, 0x0, 0x0)
/usr/local/go/src/net/dnsclient_unix.go:143 +0x3ec
net.tryOneName(0xc8200de580, 0xc82013b050, 0x23, 0x230001, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/usr/local/go/src/net/dnsclient_unix.go:176 +0x425
net.goLookupIPOrder.func1(0xc8200de580, 0xc820145270, 0xc8200b8a20, 0x1)
/usr/local/go/src/net/dnsclient_unix.go:452 +0x59
created by net.goLookupIPOrder
/usr/local/go/src/net/dnsclient_unix.go:454 +0x3ba
goroutine 1 [chan receive]:
github.com/zeroturnaround/configo/vendor/github.com/ahmetalpbalkan/go-linq.ParallelQuery.Select(0xc820144be0, 0x1, 0x1, 0x1, 0x0, 0x0, 0xa290c8, 0xc820144bf0, 0x1, 0x1, ...)
/home/ubuntu/.go_workspace/src/github.com/zeroturnaround/configo/vendor/github.com/ahmetalpbalkan/go-linq/plinq.go:197 +0x3a5
github.com/zeroturnaround/configo/sources.(*CompositeSource).Get(0xc820139c20, 0x1, 0x0, 0x0)
/home/ubuntu/.go_workspace/src/github.com/zeroturnaround/configo/sources/composite.go:38 +0x40a
main.resolveAll(0xc82012ca00, 0x50, 0x50, 0x0, 0x0)
/home/ubuntu/.go_workspace/src/github.com/zeroturnaround/configo/main.go:120 +0x57f
main.main()
/home/ubuntu/.go_workspace/src/github.com/zeroturnaround/configo/main.go:71 +0x596
goroutine 18 [select]:
net/http.(*Transport).getConn(0xc8200b07e0, 0xc8200e82a0, 0x0, 0xc82013aa50, 0x5, 0xc82013ac30, 0x26, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/transport.go:554 +0x663
net/http.(*Transport).RoundTrip(0xc8200b07e0, 0xc8200e82a0, 0x2, 0x0, 0x0)
/usr/local/go/src/net/http/transport.go:228 +0x4ac
net/http.send(0xc8200e82a0, 0x1047620, 0xc8200b07e0, 0xc82014a140, 0x0, 0x0)
/usr/local/go/src/net/http/client.go:220 +0x52c
net/http.(*Client).send(0xc82013ab40, 0xc8200e82a0, 0x3f, 0x0, 0x0)
/usr/local/go/src/net/http/client.go:143 +0x15a
net/http.(*Client).doFollowingRedirects(0xc82013ab40, 0xc8200e82a0, 0xa2ab28, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/client.go:380 +0xbc0
net/http.(*Client).Do(0xc82013ab40, 0xc8200e82a0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/client.go:175 +0x9c
github.com/zeroturnaround/configo/vendor/github.com/hashicorp/vault/api.(*Client).RawRequest(0xc82014eee0, 0xc820049d80, 0xc8200de3a8, 0x0, 0x0)
/home/ubuntu/.go_workspace/src/github.com/zeroturnaround/configo/vendor/github.com/hashicorp/vault/api/client.go:248 +0xcc
github.com/zeroturnaround/configo/vendor/github.com/hashicorp/vault/api.(*Logical).Read(0xc820049e20, 0xc82014edc0, 0x11, 0x0, 0x0, 0x0)
/home/ubuntu/.go_workspace/src/github.com/zeroturnaround/configo/vendor/github.com/hashicorp/vault/api/logical.go:15 +0x268
github.com/zeroturnaround/configo/sources.(*VaultSource).Get(0xc82013aae0, 0x732060, 0x0, 0x0)
/home/ubuntu/.go_workspace/src/github.com/zeroturnaround/configo/sources/vault.go:25 +0x134
github.com/zeroturnaround/configo/sources.(*CompositeSource).Get.func2(0x732060, 0xc82013aae0, 0x0, 0x0, 0x0, 0x0)
/home/ubuntu/.go_workspace/src/github.com/zeroturnaround/configo/sources/composite.go:30 +0x97
github.com/zeroturnaround/configo/vendor/github.com/ahmetalpbalkan/go-linq.ParallelQuery.Select.func1(0xc8200b8600, 0x0, 0xa290c8, 0x732060, 0xc82013aae0)
/home/ubuntu/.go_workspace/src/github.com/zeroturnaround/configo/vendor/github.com/ahmetalpbalkan/go-linq/plinq.go:186 +0xac
created by github.com/zeroturnaround/configo/vendor/github.com/ahmetalpbalkan/go-linq.ParallelQuery.Select
/home/ubuntu/.go_workspace/src/github.com/zeroturnaround/configo/vendor/github.com/ahmetalpbalkan/go-linq/plinq.go:193 +0x341
goroutine 20 [select]:
net.lookupIPDeadline(0xc82013ac30, 0x22, 0xe7791f71e, 0x0, 0xce5d40, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/lookup.go:109 +0x6a5
net.internetAddrList(0x8b4e08, 0x3, 0xc82013ac30, 0x26, 0xe7791f71e, 0x0, 0xce5d40, 0x0, 0x0, 0x0, ...)
/usr/local/go/src/net/ipsock.go:252 +0x6ee
net.resolveAddrList(0x8b0e60, 0x4, 0x8b4e08, 0x3, 0xc82013ac30, 0x26, 0xe7791f71e, 0xc800000000, 0xce5d40, 0x0, ...)
/usr/local/go/src/net/dial.go:153 +0x466
net.(*Dialer).Dial(0xc820094f00, 0x8b4e08, 0x3, 0xc82013ac30, 0x26, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/dial.go:209 +0x124
net.(*Dialer).Dial-fm(0x8b4e08, 0x3, 0xc82013ac30, 0x26, 0x0, 0x0, 0x0, 0x0)
/home/ubuntu/.go_workspace/src/github.com/zeroturnaround/configo/vendor/github.com/coreos/etcd/client/client.go:49 +0x6e
net/http.(*Transport).dial(0xc8200b07e0, 0x8b4e08, 0x3, 0xc82013ac30, 0x26, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/transport.go:499 +0x79
net/http.(*Transport).dialConn(0xc8200b07e0, 0x0, 0xc82013aa50, 0x5, 0xc82013ac30, 0x26, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/transport.go:596 +0x19a9
net/http.(*Transport).getConn.func4(0xc8200b07e0, 0x0, 0xc82013aa50, 0x5, 0xc82013ac30, 0x26, 0xc8200b8660)
/usr/local/go/src/net/http/transport.go:549 +0x66
created by net/http.(*Transport).getConn
/usr/local/go/src/net/http/transport.go:551 +0x265
goroutine 21 [chan receive]:
net.goLookupIPOrder(0xc82013ac30, 0x22, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/dnsclient_unix.go:457 +0x444
net.lookupIP(0xc82013ac30, 0x22, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/lookup_unix.go:73 +0x153
net.glob.func15(0xa2aa48, 0xc82013ac30, 0x22, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/hook.go:10 +0x4d
net.lookupIPDeadline.func1(0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/lookup.go:106 +0x71
internal/singleflight.(*Group).doCall(0xce5120, 0xc820094f50, 0xc82013ac30, 0x22, 0xc82014ef80)
/usr/local/go/src/internal/singleflight/singleflight.go:93 +0x2c
created by internal/singleflight.(*Group).DoChan
/usr/local/go/src/internal/singleflight/singleflight.go:86 +0x3ed
goroutine 23 [runnable]:
syscall.Syscall(0x6, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/syscall/asm_darwin_amd64.s:16 +0x5
syscall.Close(0x3, 0x0, 0x0)
/usr/local/go/src/syscall/zsyscall_darwin_amd64.go:404 +0x4a
net.(*netFD).destroy(0xc820168000)
/usr/local/go/src/net/fd_unix.go:135 +0x46
net.(*netFD).decref(0xc820168000)
/usr/local/go/src/net/fd_unix.go:153 +0x40
net.(*netFD).Close(0xc820168000, 0x0, 0x0)
/usr/local/go/src/net/fd_unix.go:199 +0x87
net.(*conn).Close(0xc820170000, 0x0, 0x0)
/usr/local/go/src/net/net.go:196 +0xab
sync.(*Mutex).Lock(0xc82009a000)
/usr/local/go/src/sync/mutex.go:74 +0x16d
math/rand.(*lockedSource).Int63(0xc82009a000, 0x0)
/usr/local/go/src/math/rand/rand.go:239 +0x28
math/rand.(*Rand).Int63(0xc820092110, 0x611f5)
/usr/local/go/src/math/rand/rand.go:46 +0x39
math/rand.(*Rand).Int(0xc820092110, 0x0)
/usr/local/go/src/math/rand/rand.go:56 +0x21
math/rand.Int(0xc820170000)
/usr/local/go/src/math/rand/rand.go:183 +0x23
net.exchange(0xc82015e0d0, 0xc, 0xc82013b050, 0x23, 0xc82015001c, 0x12a05f200, 0x0, 0x0, 0x0)
/usr/local/go/src/net/dnsclient_unix.go:143 +0x3ec
net.tryOneName(0xc8200de580, 0xc82013b050, 0x23, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/usr/local/go/src/net/dnsclient_unix.go:176 +0x425
net.goLookupIPOrder.func1(0xc8200de580, 0xc820145270, 0xc8200b8a20, 0x1c)
/usr/local/go/src/net/dnsclient_unix.go:452 +0x59
created by net.goLookupIPOrder
/usr/local/go/src/net/dnsclient_unix.go:454 +0x3ba
Could you please help me resolve this issue?
github.com/ahmetalpbalkan/go-linq
Great tool!
IMHO just one option missed: create son/xml file as result of parsing config sources. I have a lot of legacy code that required json/yaml config files. it would be great to dump json/yaml to disk.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.