config

package
v0.0.0-...-2cb5aa6 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2019 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package config is in charge of loading policies files from disk or remote Github URL.

It also contains the view for the __reload__ endpoint.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLoader

func AddLoader(l Loader)

AddLoader allows to plug new kinds of loaders.

func Load

func Load(sources []string) (doorman.ServicesConfig, error)

Load will load and parse the specified sources.

Types

type FileLoader

type FileLoader struct{}

FileLoader loads from local disk (file, folder)

func (*FileLoader) CanLoad

func (f *FileLoader) CanLoad(path string) bool

CanLoad will return true if the path exists.

func (*FileLoader) Load

func (f *FileLoader) Load(path string) (doorman.ServicesConfig, error)

Load reads the local file or scans the folder.

type GithubLoader

type GithubLoader struct {
	Token string
}

GithubLoader reads configuration from Github URLs.

func (*GithubLoader) CanLoad

func (ghl *GithubLoader) CanLoad(url string) bool

CanLoad will return true if the URL contains github

func (*GithubLoader) Load

func (ghl *GithubLoader) Load(source string) (doorman.ServicesConfig, error)

Load downloads the URL into a temporary folder and loads it from disk

type Loader

type Loader interface {
	// CanLoad determines if the loader can handle this source.
	CanLoad(source string) bool
	// Parse and return the configs for this source.
	Load(source string) (doorman.ServicesConfig, error)
}

Loader is responsible for loading the policies from files, URLs, etc.

Source Files

  • lint.go
  • loader.go
  • loader_file.go
  • loader_github.go

Jump to

Keyboard shortcuts

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