Commit Graph

30 Commits

Author SHA1 Message Date
a1eaf9cc20 linting fixes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-12-04 00:22:02 +03:00
Till Knuesting
f67c5e779f preallocated slices (#917) 2019-11-05 17:43:12 +00:00
Asim Aslam
af5d7a3420 Move the remaining consul cruft to go-plugins 2019-10-03 11:22:35 +01:00
Milos Gajdos
87a5e85062 Add 1.13 support. Fix tests to enable 1.13 support 2019-09-27 17:14:24 +01:00
Yumin Wu
5b991cd2c2 Update config source README file 2019-09-04 15:49:58 +08:00
Yumin Wu
ff81e4b246 Load consul source 2019-08-30 16:20:58 +08:00
Milos Gajdos
4ea27517b5
Source watcher ErrStoppedWatcher and fixed test 2019-08-20 22:32:47 +01:00
Shu Xian
2413cbcd80 fix file watcher event bug on Linux
the watcher can not normally get events of file changes on linux. it just can get the first two changes.
2019-08-19 15:28:24 +08:00
刘小乐
cd2ac648ff
Fix read yaml config from memory
package main

import (
	"fmt"

	"github.com/micro/go-micro/config"
	"github.com/micro/go-micro/config/source/memory"
)

var configData = []byte(`
---
a: 1234
`)

func main() {
	memorySource := memory.NewSource(
		memory.WithYAML(configData),
	)
	// Create new config
	conf := config.NewConfig()

	// Load file source
	conf.Load(memorySource)

	fmt.Println(string(conf.Bytes()))
}
2019-08-11 18:05:35 +08:00
刘小乐
7bd6d1b549
no more WithData method, instead of WithJSON 2019-08-09 12:45:59 +08:00
magodo
a8dbca756c rename stuff per feedback 2019-06-25 22:41:31 +08:00
magodo
8e4fd16aff Add consul-specific option for config (as registry) 2019-06-25 18:31:32 +08:00
magodo
6ef838c9aa Merge branch 'master' of https://github.com/micro/go-micro into config_source_consul_support_array 2019-06-22 07:14:15 +08:00
Asim Aslam
b4acb9bb58
Merge pull request #538 from magodo/consul_path_prefix_leading_slash
config consul source supports slash as prefix
2019-06-21 14:23:53 +01:00
Asim Aslam
c350e19552 Move cmd => config/cmd 2019-06-21 13:36:11 +01:00
magodo
3c82b2e9e8 Merge branch 'consul_path_prefix_leading_slash' into dev 2019-06-21 16:53:21 +08:00
magodo
7acd249147 config consul source supports slash as prefix
`config.NewConfig()` with consul source will both read from consul
and watch consul for changes. Hence, the `prefix` is used in these
2 cases:

- read case: it is used to strip path based on the `KVPair` returned
from consul `kv.List()` method
- watch case: it is used as the `key` of watch query (`keyprefix` type)

So for *watch case*, the `key` is leagal to be `/` for watching change
on root. While for *read case*, because `KVPair.Key` is always stripped
off the leading slash, so if user specified some `prefix` with leading
slash, we should strip it also.

An extream case would be: user want's to read & watch node in root dir.
One would specify `prefix` as `/`, and it should work then.
2019-06-21 16:35:48 +08:00
magodo
1983b4ae92 variable rename to abstract encoder 2019-06-21 15:30:45 +08:00
magodo
92b998c3ab consul config source support 1st-level array
Check whetehr the 1st level encoded json is array or not, to
support 1st level array in consul config.

During debug, i suspected the incapability of arrray is caused by
json reader, so i added test for array. I think it makes no harm
to also check that in.
2019-06-21 00:25:39 +08:00
magodo
606b1ff7cf prefix in consul api starts with no leading slash
When `consul.StripPrefix(true)` is set, current impl. will pass the
specified prefix (or default prefix) when calling consul api.

However, `prefix` in consul api starts with no leading slash, so
the default prefix (`/micro/config`) doesn't actually work.

I avoid code changes (esp. the one in `util.go`) to eliminate
impact on users who already notice it.
2019-06-19 14:42:09 +08:00
Asim Aslam
aec1ca6635 remove etcd source 2019-06-11 09:53:06 +01:00
outshow
90a9df9b8c 1. use github.com/coreos instead of go.etcd.io in etcd related import path; 2. add dialtimeout to etcd client 2019-06-11 16:18:37 +08:00
Asim Aslam
a2fbf19341 Move sync deps, change uuid to google and update go.mod 2019-06-07 13:53:42 +01:00
Asim Aslam
2aba26d4d1 change logger 2019-05-31 16:03:50 +01:00
Asim Aslam
f9f893fa85 update source 2019-05-31 15:59:21 +01:00
Asim Aslam
30627c32c9 the garbage commit of go.mod vault deps 2019-05-31 15:24:15 +01:00
Asim Aslam
1374c5b14a update syntax 2019-05-31 13:45:28 +01:00
Asim Aslam
082d0b9f05 add memory config source options for json/yaml 2019-05-31 13:44:28 +01:00
Asim Aslam
ef9c223ac8 add vault/etcd 2019-05-31 12:38:49 +01:00
Asim Aslam
5e6491b7b0 add config 2019-05-30 23:11:13 +01:00