config

package
v0.0.0-...-47ace37 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Custom

func Custom() error

Custom is responsible to load custom configurations

First it checks whether user have specified custom configs. Then checks whether them are suitable and valid. Finally tries to load them.

func ServiceProviderConfig

func ServiceProviderConfig() core.ServiceProviderConfig

ServiceProviderConfig returns the current service provider config

func Valid

func Valid() (bool, error)

Valid checks wheter the configuration is valid or not

Types

type Configuration

type Configuration struct {
	Storage
	Debug                 bool
	Port                  int    `default:"8787" validate:"min=1024,max=65535"`
	ServiceProviderConfig string `validate:"omitempty,pathexists,isfile=.json"`
	Config                string `validate:"omitempty,pathexists,isdir,hassubdir=schemas,hassubdir=resources"` // (todo) > check the config directory contains two directories, one for resource types and one for schemas, and that them contains json files
	PageSize              int    `default:"10" validate:"min=1,max=10"`
	Enable
}

Configuration is ...

var (
	// Values contains the configuration values
	Values *Configuration
	// Errors contains the happened configuration errors
	Errors validator.ValidationErrors
)

type Enable

type Enable struct {
	Self bool
}

Enable is ...

type Storage

type Storage struct {
	Type string `default:"mongo" validate:"eq=mongo"` // (note) > since we are only supporting mongo at the moment
	Host string `default:"0.0.0.0" validate:"hostname|ip4_addr"`
	Port int    `default:"27017" validate:"min=1024,max=65535"`
	Name string `default:"scimd" validate:"min=1,excludesall=/\\.*<>:?$\""` // cannot contain any of these characters /, \, ., *, <, >, :, , ?, $, " (fixme) exclude also => |
	Coll string `default:"resources" validate:"min=1,excludes=$,nstartswith=system."`
}

Storage is ...

Jump to

Keyboard shortcuts

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