config

package
v3.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package config defines all the configuration parameters. It reads configuration from environment variables and command-line arguments.

Index

Constants

This section is empty.

Variables

View Source
var (
	// default values for X.509 certificate signing request
	DEFAULT_COUNTRY             = "US"
	DEFAULT_PROVINCE            string
	DEFAULT_ORGANIZATION        string
	DEFAULT_ORGANIZATIONAL_UNIT = "Athenz"

	// default values for role tokens and access tokens
	DEFAULT_TOKEN_REFRESH        = 30 * time.Minute
	DEFAULT_TOKEN_EXPIRY_RAW     = "0"
	DEFAULT_TOKEN_EXPIRY         = time.Duration(0)
	DEFAULT_TOKEN_SERVER_TIMEOUT = 3 * time.Second

	// DEFAULT_ROLE_CERT_EXPIRY_TIME_BUFFER_MINUTES may be overwritten with go build option (e.g. "-X identity.DEFAULT_ROLE_CERT_EXPIRY_TIME_BUFFER_MINUTES=5")
	DEFAULT_ROLE_CERT_EXPIRY_TIME_BUFFER_MINUTES_RAW = "5"
	DEFAULT_ROLE_CERT_EXPIRY_TIME_BUFFER_MINUTES     = 5

	DEFAULT_ENDPOINT                     string
	DEFAULT_ROLE_AUTH_HEADER             = "Athenz-Role-Auth"
	DEFAULT_DNS_SUFFIX                   = "athenz.cloud"
	DEFAULT_ROLE_CERT_FILENAME_DELIMITER = ":role."
	DEFAULT_INTERMEDIATE_CERT_BUNDLE     string

	// default values for graceful shutdown
	DEFAULT_SHUTDOWN_TIMEOUT = 5 * time.Second
	DEFAULT_SHUTDOWN_DELAY   = time.Duration(0)

	// default maximum elapsed time on initialization
	DEFAULT_MAX_ELAPSED_TIME_ON_INIT = 1 * time.Minute
)
View Source
var (
	// VERSION is a constant storing the SIA version, provided by the build argument in go build
	VERSION string

	// VERSION is a constant storing the SIA build date, provided by the build argument in go build
	BUILD_DATE string

	// APP_NAME is a constant storing the binary name, provided by the command line
	APP_NAME = filepath.Base(os.Args[0])

	// USER_AGENT is a constant storing the User-Agent Header value, computed on package loading
	USER_AGENT = fmt.Sprintf("%s/%s", APP_NAME, VERSION)
)
View Source
var ErrHelp = flag.ErrHelp
View Source
var ErrVersion = errors.New("flag: version requested")

Functions

This section is empty.

Types

type DomainRole

type DomainRole struct {
	Domain string
	Role   string
}

func (DomainRole) String

func (dr DomainRole) String() string

type IdentityConfig

type IdentityConfig struct {
	Init                      bool
	Endpoint                  string
	ProviderService           string
	DNSSuffix                 string
	Refresh                   time.Duration
	DelayJitterSeconds        int64
	KeyFile                   string
	CertFile                  string
	CaCertFile                string
	IntermediateCertBundle    string
	Backup                    string
	CertSecret                string
	Namespace                 string
	AthenzDomain              string
	AthenzPrefix              string
	AthenzSuffix              string
	ServiceAccount            string
	SaTokenFile               string
	PodIP                     net.IP
	PodUID                    string
	PodName                   string
	Reloader                  *util.CertReloader
	ServerCACert              string
	TargetDomainRoles         []DomainRole
	RoleCertDir               string
	RoleCertFilenameDelimiter string
	RoleCertKeyFileOutput     bool
	RoleAuthHeader            string
	TokenType                 string
	TokenRefresh              time.Duration
	TokenExpiry               time.Duration
	TokenServerAddr           string
	TokenServerRESTAPI        bool
	TokenServerTimeout        time.Duration
	TokenServerTLSCAPath      string
	TokenServerTLSCertPath    string
	TokenServerTLSKeyPath     string
	TokenDir                  string
	MetricsServerAddr         string
	HealthCheckAddr           string
	HealthCheckEndpoint       string
	DeleteInstanceID          bool
	UseTokenServer            bool
	ShutdownTimeout           time.Duration
	ShutdownDelay             time.Duration

	LogDir   string
	LogLevel string
	// contains filtered or unexported fields
}

IdentityConfig from cmd line args

func DefaultIdentityConfig

func DefaultIdentityConfig() *IdentityConfig

func LoadConfig

func LoadConfig(program string, args []string) (*IdentityConfig, error)

LoadConfig reads from ENV and args, and then returns an IdentityConfig object (precedence: args > ENV > default).

Jump to

Keyboard shortcuts

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