url2

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

README

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 gitlab source
conf.Load(urlSource)

Documentation

Overview

Package gitlab loads changesets from a gitlab

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultTlsConfig   = tls.Config{}
	DefaultEndpoint, _ = url.Parse("https://127.0.0.1:3000")
	DefaultFormat      = "json"
	DefaultTimeout     = time.Second * 5
	DefaultRetries     = 10
	DefaultInterval    = time.Second * 1
)

Functions

func NewSource

func NewSource(projectId int, files string, opts ...source.Option) source.Source

func RespSha256

func RespSha256(response *http.Response) string

func WithBranch

func WithBranch(u string) source.Option

func WithEndpoint

func WithEndpoint(u url.URL) source.Option

func WithInterval

func WithInterval(u time.Duration) source.Option

func WithRetries

func WithRetries(u int) source.Option

func WithTimeout

func WithTimeout(u time.Duration) source.Option

func WithTlsConfig

func WithTlsConfig(u tls.Config) source.Option

func WithToken

func WithToken(u string) source.Option

Types

type Url2Source

type Url2Source struct {
	Interval time.Duration
	// contains filtered or unexported fields
}

TODO unit test

func (*Url2Source) Read

func (u *Url2Source) Read() (*source.ChangeSet, error)

func (*Url2Source) String

func (u *Url2Source) String() string

func (*Url2Source) Watch

func (u *Url2Source) Watch() (source.Watcher, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL