1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-12 08:23:58 +02:00
go-micro/plugins/config/source/url
2021-11-11 14:03:34 +00:00
..
format_test.go add all the plugins 2020-12-26 15:32:45 +00:00
format.go add all the plugins 2020-12-26 15:32:45 +00:00
go.mod upgrade to go 1.17 (#2346) 2021-11-11 14:03:34 +00:00
go.sum upgrade to go 1.17 (#2346) 2021-11-11 14:03:34 +00:00
options.go go-micro.dev/v4 (#2305) 2021-10-12 12:55:53 +01:00
README.md add all the plugins 2020-12-26 15:32:45 +00:00
url.go replace ioutil with io and os (#2327) 2021-10-30 19:24:40 +01:00
watcher.go go-micro.dev/v4 (#2305) 2021-10-12 12:55:53 +01:00

URL Source

The URL source reads config from a url.

It uses the Content-Type header as the format e.g application/json becomes json. The content itself is not touched. If we can't find a format we'll use the encoder format.

New Source

Specify url source with url. Defaults to http://localhost:8080/config.

urlSource := url.NewSource(
	url.WithURL("http://api.example.com/config"),
)

Load Source

Load the source into config

// Create new config
conf := config.NewConfig()

// Load url source
conf.Load(urlSource)