config

package
v0.0.0-...-9a7b936 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Default = Config{
		ListenPort:   8080,
		Secret:       "352d20ee67be67f6340b4c0605b044b7",
		TemplatePath: "templates",
	}
)

Functions

func Load

func Load(paths []string, conf *Config) error

Load will load a configuration file, trying each of the paths given and using the first one that is a regular file and can be opened.

If none exists, a default config will be written to the first path in the list.

An error will be returned only if any of the paths existed but was not a valid config file.

func WriteConf

func WriteConf(path string, conf *Config) error

WriteConf will write conf file to specified path.

func WriteDefault

func WriteDefault(path string, conf *Config) error

WriteDefault will set conf to the default config and write it to disk in path, if the path is non-empty.

Types

type AnalyticsConfigConfig

type AnalyticsConfigConfig struct {
	Type                    string              `json:"type"`
	IgnoredIPs              []string            `json:"ignored_ips"`
	EnableDetailedRecording bool                `json:"enable_detailed_recording"`
	EnableGeoIP             bool                `json:"enable_geo_ip"`
	NormaliseUrls           NormalisedURLConfig `json:"normalise_urls"`
	PoolSize                int                 `json:"pool_size"`
	RecordsBufferSize       uint64              `json:"records_buffer_size"`
	StorageExpirationTime   int                 `json:"storage_expiration_time"`
	// contains filtered or unexported fields
}

type AuthOverrideConf

type AuthOverrideConf struct {
	ForceAuthProvider    bool `json:"force_auth_provider"`
	ForceSessionProvider bool `json:"force_session_provider"`
}

type CertData

type CertData struct {
	Name     string `json:"name"`
	CertFile string `json:"cert_file"`
	KeyFile  string `key_file`
}

type Config

type Config struct {
	// OriginalPath is the path to the config file that was read.
	// If none was found, it's the path to the default config file
	// that was written.
	OriginalPath string `json:"-"`

	HostName             string `json:"host_name"`
	ListenAddress        string `json:"listen_address"`
	ListenPort           int    `json:"listen_port"`
	ControlAPIHostname   string `json:"control_api_hostname"`
	ControlAPIPort       int    `json:"control_api_port"`
	Secret               string `json:"secret"`
	NodeSecret           string `json:"node_secret"`
	PIDFileLocation      string `json:"pid_file_location"`
	AllowInsecureConfigs bool   `json:"allow_insecure_configs"`
	PublicKeyPath        string `json:"public_key_path"`
	AllowRemoteConfig    bool   `json:"allow_remote_config"`
}

Config is the configuration object used by raspberry to set up various parameters.

type DBAppConfOptionsConfig

type DBAppConfOptionsConfig struct {
	ConnectionString string   `json:"connection_string"`
	NodeIsSegmented  bool     `json:"node_is_segmented"`
	Tags             []string `json:"tags"`
}

DBAppConfOptionsConfig definited for DB

type DnsCacheConfig

type DnsCacheConfig struct {
	Enbaled bool  `json:"enabled"`
	TTL     int64 `json:"ttl"`
	// CheckInterval controls cache cleanup interval. By convention shouldn't be exposed to config or env_variable_setup
	CheckInterval            int64             `json:"check_interval"`
	MultipleIPsHandleStategy IPsHandleStrategy `json:"multiple_ips_handle_stategy"`
}

type HealthCheckConfig

type HealthCheckConfig struct {
	EnableHealthChecks      bool  `json:"enable_health_checks"`
	HealthCheckValueTimeout int64 `json:"health_check_value_timeouts"`
}

type HttpServerOptionsConfig

type HttpServerOptionsConfig struct {
	OverrideDefaults       bool       `json:"override_defaults"`
	ReadTimeout            int        `json:"read_timeout"`
	WriteTimeout           int        `json:"write_timeout"`
	UseSSL                 bool       `json:'use_ssl'`
	UseLe_SSL              bool       `json:"use_ssl_le"`
	EnableHttp2            bool       `json:"enable_http2"`
	SSLInsecureSkipVerify  bool       `json:"ssl_insecure_skip_verify"`
	EnableWebSockets       bool       `json:"enable_web_sockets"`
	Certificates           []CertData `json:"certificates"`
	SSLCertificates        []string   `json:"ssl_certificates"`
	ServerName             string     `json:"server_name"`
	MinVersion             uint16     `json:"min_version"`
	FlushIntercal          int        `json:"flush_interval"`
	SkipURLCleaning        bool       `json:"skip_url_cleaning"`
	SkipTargetPathEscaping bool       `json:"skip_target_path_escaping"`
	Ciphers                []string   `json:"cliphers"`
}

type IPsHandleStrategy

type IPsHandleStrategy string
const (
	PickFirstStrategy IPsHandleStrategy = "pick_first"
	RandomStrategy    IPsHandleStrategy = "random"
	NoCacheStrategy   IPsHandleStrategy = "no_cache"

	DefalutDashPolicySource     = "service"
	DefaultDashPolicyRecordName = "raspberry_policies"
)

type LivenessCheckConfig

type LivenessCheckConfig struct {
	CheckDuration time.Duration `json:"check_duration"`
}

type LocalSessionCacheConf

type LocalSessionCacheConf struct {
	DisableCacheSessionState bool `json:"disable_cache_session_state"`
	CachedSessionTimeout     int  `json:"cached_session_timeout"`
	CacheSessionEviction     int  `json:"cache_session_evication"`
}

type MonitorConfig

type MonitorConfig struct {
	EnableTriggerMonitors bool               `json:"enable_trigger_monitors"`
	Config                WebHookHandlerConf `json:"configuration"`
	GlobalTriggerLimit    float64            `json:"global_trogger_limit"`
	MonitorUserKeys       bool               `json:"monitor_user_keys"`
	MonitorOrgKeys        bool               `json:"monitor_org_keys"`
}

type NormaliseURLPatterns

type NormaliseURLPatterns struct {
	UUIDs  *regexp.Regexp
	IDs    *regexp.Regexp
	Custom []*regexp.Regexp
}

type NormalisedURLConfig

type NormalisedURLConfig struct {
	Enabled            bool                 `json:"enabled"`
	NormaliseUUIDs     bool                 `json:"normalise_uuids"`
	NormaliseNumbers   bool                 `json:"normalise_numbers"`
	Custom             []string             `json:"custom_patterns"`
	CompiledPatternSet NormaliseURLPatterns `json:"-"` // see analytics.go
}

type PoliciesConfig

type PoliciesConfig struct {
	PolicySource           string `json:"policy_source"`
	PolicyConnectionString string `json:"policy_connection_string"`
	PolicyRecordName       string `json:"policy_record_name"`
	AllowExplicitPolicyID  string `json:"allow_explicit_policy_id"`
}

type SlaveOptionsConfig

type SlaveOptionsConfig struct {
	UseRPC                          bool   `json:"use_roc"`
	UseSSL                          bool   `json:"use_ssl"`
	SSLInsecureSkipVerify           bool   `json:"ssl_insecure_skip_vevify"`
	ConnectionString                string `json:"connection_string"`
	RPCKey                          string `json:"rpc_key"`
	APIKey                          string `json:"api_key"`
	EnableRPCCache                  bool   `json:"enable_rpc_cache"`
	BindToSlugsInsteadOfListenPaths bool   `json:"bind_to_slugs"`
	DisableKeySpaceSync             bool   `json:"disable_key_space_sync"`
	GroupID                         string `json:"group_id"`
	CallTimeout                     int    `json:"call_timeout"`
	PingTimeout                     int    `json:"ping_timeout"`
	RPCPoolSize                     int    `json:"rpc_pool_size"`
}

type StorageOptionsConf

type StorageOptionsConf struct {
	Type                  string            `json:"type"`
	Host                  string            `json:"host"`
	Port                  int               `json:"port"`
	Hosts                 map[string]string `json:"hosts"`
	Addrs                 []string          `json:"addrs"`
	MasterName            string            `json:"master_name"`
	Username              string            `json:"username"`
	Password              string            `json:"password"`
	Database              int               `json:"database"`
	MaxIdle               int               `json:"optimisation_max_idle"`
	MaxActive             int               `json:"optimisation_max_active"`
	Timeout               int               `json:"timeout"`
	EnableCluster         bool              `json:"enable_cluster"`
	UseSSL                bool              `json:"use_ssl"`
	SSLInsecureSkipVerify bool              `json:"ssl_insecure_skip_verify"`
}

StorageOptionsConf definited for storage

type WebHookHandlerConf

type WebHookHandlerConf struct {
	Method       string            `bson:"method" json:"method"`
	TargetPath   string            `bson:"target_path" json:"target_path"`
	TemplatePath string            `bson:"template_path" josn:"template_path"`
	HeaderList   map[string]string `bson:"header_map" json:"header_map"`
	EventTimeout int64             `bson:"event_timeout" json:"event_timeout"`
}

Jump to

Keyboard shortcuts

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