config

package
v1.4.8 Latest Latest
Warning

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

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

Documentation

Overview

* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

View Source
const (

	// ModeSingle run as a single server
	ModeSingle = "single"
	// ModeCluster run as a cluster peer
	ModeCluster = "cluster"
)

Variables

This section is empty.

Functions

func Verify

func Verify(c *Config) (err error)

Verify Provide config verification

Types

type Config

type Config struct {
	Mode       string       `yaml:"mode"`
	Node       string       `yaml:"node"`
	Cluster    string       `yaml:"cluster"`
	DataDir    string       `yaml:"dataDir"`
	Listener   Listener     `yaml:"listener"`
	Join       Join         `yaml:"join"`
	Task       Task         `yaml:"task"`
	Registry   Registry     `yaml:"registry"`
	TLSConfigs []*TLSConfig `yaml:"tlsConfigs"`
}

Config is the configuration that can be set for Syncer. Some of these configurations are exposed as command-line flags.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default config

func LoadConfig

func LoadConfig(filepath string) (*Config, error)

LoadConfig loads configuration from file

func Merge

func Merge(configs ...Config) (conf Config)

Merge multiple configurations into one

func (*Config) GetTLSConfig

func (c *Config) GetTLSConfig(name string) *TLSConfig

type Join

type Join struct {
	Enabled       bool   `yaml:"enabled"`
	Address       string `yaml:"address"`
	RetryMax      int    `yaml:"retryMax"`
	RetryInterval string `yaml:"retryInterval"`
}

Join Configuration for Syncer join the network

type Label

type Label struct {
	Key   string
	Value string
}

Label pair of key and value

type Listener

type Listener struct {
	BindAddr      string `yaml:"bindAddr"`
	AdvertiseAddr string `yaml:"advertiseAddr"`
	RPCAddr       string `yaml:"rpcAddr"`
	PeerAddr      string `yaml:"peerAddr"`
	TLSMount      Mount  `yaml:"tlsMount"`
}

Listener Configuration for Syncer listener

type Mount

type Mount struct {
	Enabled bool   `yaml:"enabled"`
	Name    string `yaml:"name"`
}

Mount Specifying config and purpose

type Registry

type Registry struct {
	// Address is the service registry address.
	Address  string `json:"address"`
	Plugin   string `yaml:"plugin"`
	TLSMount Mount  `yaml:"tlsMount"`
}

Registry configuration

type TLSConfig

type TLSConfig struct {
	Name       string   `yaml:"name"`
	VerifyPeer bool     `yaml:"verifyPeer"`
	MinVersion string   `yaml:"minVersion"`
	Passphrase string   `yaml:"passphrase"`
	CAFile     string   `yaml:"caFile"`
	CertFile   string   `yaml:"certFile"`
	KeyFile    string   `yaml:"keyFile"`
	Ciphers    []string `yaml:"ciphers"`
}

TLSConfig tls configuration

type Task

type Task struct {
	Kind   string  `yaml:"kind"`
	Params []Label `yaml:"params"`
}

Task

Jump to

Keyboard shortcuts

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