config

package
v0.0.0-...-62f7a63 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Prefix is used to determine the XDG config directory.
	Prefix = "antares"
)

Variables

View Source
var DefaultConfig = Config{
	Host: "0.0.0.0",
	Port: 2002,
	Prometheus: struct {
		Host string
		Port int
	}{
		Host: "0.0.0.0",
		Port: 2004,
	},
	Database: struct {
		DryRun   bool
		Host     string
		Port     int
		Name     string
		Password string
		User     string
		SSLMode  string
	}{
		DryRun:   false,
		Host:     "0.0.0.0",
		Port:     5432,
		Name:     "antares",
		Password: "password",
		User:     "antares",
		SSLMode:  "disable",
	},
	PrivKeyRaw:      nil,
	PinningServices: []PinningService{},
	Gateways:        []Gateway{},
	UploadServices:  []UploadService{},
}

DefaultConfig the default configuration.

Functions

This section is empty.

Types

type Config

type Config struct {
	// The version string of nebula
	Version string `json:"-"`

	// The path where the configuration file is located.
	Path string `json:"-"`

	// Whether the configuration file existed when nebula was started
	Existed bool `json:"-"`

	// Determines the IPv4 network interface Antares should bind to
	Host string

	// Determines the port at which Antares will be reachable.
	Port int

	// TODO
	ListenAddrTCP ma.Multiaddr `json:"-"`

	// TODO
	ListenAddrQUIC ma.Multiaddr `json:"-"`

	// Prometheus contains the prometheus configuration
	Prometheus struct {
		// Determines the prometheus network interface to bind to.
		Host string

		// Determines the port where prometheus serves the metrics endpoint.
		Port int
	}

	// Database contains the database connection configuration
	Database struct {
		// Whether a database connection should be established or not
		DryRun bool

		// Determines the host address of the database.
		Host string

		// Determines the port of the database.
		Port int

		// Determines the name of the database that should be used.
		Name string

		// Determines the password with which we access the database.
		Password string

		// Determines the username with which we access the database.
		User string

		// Postgres SSL mode (should be one supported in https://www.postgresql.org/docs/current/libpq-ssl.html)
		SSLMode string
	}

	// TODO
	PrivKeyRaw []byte

	// TODO
	PrivKey crypto.PrivKey `json:"-"`

	// TODO
	PinningServices []PinningService

	// TODO
	Gateways []Gateway

	UploadServices []UploadService
}

Config contains general user configuration.

func Init

func Init(c *cli.Context) (*Config, error)

Init takes the command line argument and tries to read the config file from that directory.

func (*Config) Save

func (c *Config) Save() error

Save persists the configuration to disk using the `Path` field. Permissions will be 0o744

func (*Config) String

func (c *Config) String() string

String prints the configuration as a json string

type Gateway

type Gateway struct {
	Name string
	URL  string
}

type PinningService

type PinningService struct {
	Target        string
	Authorization string
}

type UploadService

type UploadService struct {
	Target        string
	Authorization string
}

Jump to

Keyboard shortcuts

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