config

package
v0.0.0-...-0fd3e05 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigFilePath specifies the path to the config file, this contains the default path
	ConfigFilePath = "config.file"
	// ConfigFilePathEnv specifies the environment variable name for the config file path
	ConfigFilePathEnv = "CONFIG_FILE_PATH"

	// ConfigDevMode specifies if the service is running in dev mode
	ConfigDevMode = "env.dev"
	// ConfigLogLevel specifies the log level
	ConfigLogLevel = "log.level"

	// ConfigDBHost specifies the host of the database
	ConfigDBHost = "db.host"
	// ConfigDBPort specifies the port of the database
	ConfigDBPort = "db.port"
	// ConfigDBName specifies the name of the database
	ConfigDBName = "db.name"
	// ConfigDBUser specifies the user of the database
	ConfigDBUser = "db.user"
	// ConfigDBPasswordPath specifies the path for file containing password of the database
	ConfigDBPasswordPath = "db.passwordPath"
	// ConfigDBPassword specifies the password of the database, not read from config file, rather from file specified by db.passwordPath
	ConfigDBPassword = "db.password"

	// ConfigTemporalHost specifies the hostname for Temporal
	ConfigTemporalHost = "temporal.host"
	// ConfigTemporalPort specifies the port for Temporal
	ConfigTemporalPort = "temporal.port"
	// ConfigTemporalServerName specifies the server name for Temporal
	ConfigTemporalServerName = "temporal.serverName"

	// ConfigTemporalNamespace specifies the namespace for Temporal
	ConfigTemporalNamespace = "temporal.namespace"
	// ConfigTemporalNamespaceEnv specifies the env var to read namespace for Temporal
	ConfigTemporalNamespaceEnv = "TEMPORAL_NAMESPACE"

	// ConfigTemporalQueue specifies the queue for Temporal
	ConfigTemporalQueue = "temporal.queue"
	// ConfigTemporalQueueEnv specifies the env var to read queue for Temporal
	ConfigTemporalQueueEnv = "TEMPORAL_QUEUE"

	// ConfigTemporalEncryptionKey specifies the data encryption key for Temporal
	ConfigTemporalEncryptionKey = "temporal.encryptionKey"
	// ConfigTemporalEncryptionKeyPath specifies the path for file containing data encryption key for Temporal
	ConfigTemporalEncryptionKeyPath = "temporal.encryptionKeyPath"

	// ConfigTemporalTlsEnabled specifies if TLS should be used with Temporal
	ConfigTemporalTlsEnabled = "temporal.tls.enabled"
	// ConfigTemporalCertPath specifies the path for client cert
	ConfigTemporalCertPath = "temporal.tls.certPath"
	// ConfigTemporalKeyPath specifies the path for client key
	ConfigTemporalKeyPath = "temporal.tls.keyPath"
	// ConfigTemporalCaPath specifies the path for server CA cert
	ConfigTemporalCaPath = "temporal.tls.caPath"

	// ConfigNgcAPIBaseURL specifies the base URL for the NGC API
	ConfigNgcAPIBaseURL = "ngc.api.baseUrl"

	// ConfigNotificationsSlackWebhookURL specifies the Slack webhook URL
	ConfigNotificationsSlackWebhookURL = "notifications.slack.webhookURL"
	// ConfigNotificationsSlackWebhookURLPath specifies file path to read Slack webhook URL
	ConfigNotificationsSlackWebhookURLPath = "notifications.slack.webhookURLPath"

	// ConfigSiteManagerEndpoint is the service endpoint for site manager
	ConfigSiteManagerEndpoint = "siteManager.svcEndpoint"

	// ConfigMetricsEnabled is a feature flag for Prometheus metrics
	ConfigMetricsEnabled = "metrics.enabled"
	// ConfigMetricsPort specifies the port for Prometheus metrics
	ConfigMetricsPort = "metrics.port"
	// ConfigMetricsNamespace specifies the prefix for every exposed metric name
	ConfigMetricsNamespace = "metrics.namespace"

	// ConfigHealthzEnabled is a feature flag for health check endpoint
	ConfigHealthzEnabled = "healthz.enabled"
	// ConfigHealthzPort specifies the port for health check endpoint
	ConfigHealthzPort = "healthz.port"

	// ConfigTracingEnabled is a feature flag for tracing
	ConfigTracingEnabled = "tracing.enabled"
	// ConfigTracingServiceName specifies the service name for tracing
	ConfigTracingServiceName = "tracing.serviceName"

	// ConfigWorkerMaxConcurrentActivityPollers specifies how many concurrent activity
	// task pollers the Temporal worker runs. This service reads only from config.yaml
	// (Helm-rendered) -- unlike Site Agent's old-style config, there's no env var override.
	ConfigWorkerMaxConcurrentActivityPollers = "worker.maxConcurrentActivityPollers"
)
View Source
const (
	// DefaultMaxConcurrentActivityPollers is the poller count used when config.yaml
	// doesn't set worker.maxConcurrentActivityPollers. Matches the historical hardcoded value.
	DefaultMaxConcurrentActivityPollers = 10
	// MaxMaxConcurrentActivityPollers caps the configurable poller count. Each poller can
	// hold a DB connection from the shared pgx pool while its activity runs, and this worker
	// also serves the cloud task queue. Lowered from an initial 200 (an unguessed
	// fat-finger-only bound) to 20 per review: benchmarking found no throughput gain going
	// from poller=10 to poller=40 at page_size=50, and Temporal's own worker design means a
	// handful of pollers already saturates typical activity-execution-slot counts -- raising
	// this further is unlikely to help and mainly risks pgx pool exhaustion on a worker that
	// also serves the cloud task queue. Bump with fresh benchmark data if a real need appears.
	MaxMaxConcurrentActivityPollers = 20
)
View Source
const DefaultMetricsNamespace = "nico_rest_workflow"

DefaultMetricsNamespace prefixes every metric this worker exposes and matches its nico-rest-workflow Helm service name. Operators override it with metrics.namespace.

Variables

View Source
var (

	// ProjectRoot describes the folder path of this project
	ProjectRoot = filepath.Join(filepath.Dir(cur), "../..")
)

Functions

func SetupTestCerts

func SetupTestCerts(t *testing.T) (string, string)

SetupTestCerts sets up a test key and cert

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config represents configurations for the service

func GetTestConfig

func GetTestConfig() *Config

GetTestConfig returns a config for tests

func NewConfig

func NewConfig() *Config

NewConfig creates a new config object

func (*Config) Close

func (c *Config) Close()

Close stops background tasks

func (*Config) GetDBConfig

func (c *Config) GetDBConfig() *cconfig.DBConfig

GetDBConfig returns the database config

func (*Config) GetDBHost

func (c *Config) GetDBHost() string

GetDBHost returns the host of the database

func (*Config) GetDBName

func (c *Config) GetDBName() string

GetDBName returns the name of the database

func (*Config) GetDBPassword

func (c *Config) GetDBPassword() string

GetDBPassword returns the password of the database

func (*Config) GetDBPasswordPath

func (c *Config) GetDBPasswordPath() string

GetDBPasswordPath returns the path for file containing password of the database

func (*Config) GetDBPort

func (c *Config) GetDBPort() int

GetDBPort returns the port of the database

func (*Config) GetDBUser

func (c *Config) GetDBUser() string

GetDBUser returns the user of the database

func (*Config) GetDevMode

func (c *Config) GetDevMode() bool

GetDevMode returns if the service is running in dev mode

func (*Config) GetHealthzConfig

func (c *Config) GetHealthzConfig() *HealthzConfig

GetHealthzConfig returns the Healthz config

func (*Config) GetHealthzEnabled

func (c *Config) GetHealthzEnabled() bool

GetHealthzEnabled gets the enabled field for Healthz

func (*Config) GetHealthzPort

func (c *Config) GetHealthzPort() int

GetHealthzPort gets the port for Healthz

func (*Config) GetLogLevel

func (c *Config) GetLogLevel() string

GetLogLevel returns the log level

func (*Config) GetMaxConcurrentActivityPollers

func (c *Config) GetMaxConcurrentActivityPollers() int

GetMaxConcurrentActivityPollers returns the number of concurrent activity task pollers the Temporal worker should run

func (*Config) GetMetricsConfig

func (c *Config) GetMetricsConfig() *MetricsConfig

GetMetricsConfig returns the Metrics config

func (*Config) GetMetricsEnabled

func (c *Config) GetMetricsEnabled() bool

GetMetricsEnabled gets the enabled field for Metrics

func (*Config) GetMetricsNamespace

func (c *Config) GetMetricsNamespace() string

GetMetricsNamespace gets the prefix applied to every exposed metric name. An explicitly empty value falls back to the default rather than exposing unprefixed names that would collide with another service's.

func (*Config) GetMetricsPort

func (c *Config) GetMetricsPort() int

GetMetricsPort gets the port for Metrics

func (*Config) GetNgcAPIBaseURL

func (c *Config) GetNgcAPIBaseURL() string

GetNgcAPIBaseURL returns the base url for the ngc api

func (*Config) GetNotificationsSlackEnabled

func (c *Config) GetNotificationsSlackEnabled() bool

GetNotificationsSlackEnabled returns if Slack notifications are enabled

func (*Config) GetNotificationsSlackWebhookURL

func (c *Config) GetNotificationsSlackWebhookURL() string

GetNotificationsSlackWebhookURL gets the slack webhook url

func (*Config) GetNotificationsSlackWebhookURLPath

func (c *Config) GetNotificationsSlackWebhookURLPath() string

GetNotificationsSlackWebhookURLPath gets the file path to read slack webhook url

func (*Config) GetPathToConfig

func (c *Config) GetPathToConfig() string

GetPathToConfig returns the path to the config file

func (*Config) GetSiteManagerEndpoint

func (c *Config) GetSiteManagerEndpoint() string

GetSiteManagerEndpoint gets the path for site manager service endpoint

func (*Config) GetTemporalCaPath

func (c *Config) GetTemporalCaPath() string

GetTemporalCaPath returns the path for ca cert for Temporal

func (*Config) GetTemporalCertPath

func (c *Config) GetTemporalCertPath() string

GetTemporalCertPath returns the path for client cert for Temporal

func (*Config) GetTemporalConfig

func (c *Config) GetTemporalConfig() (*cconfig.TemporalConfig, error)

GetTemporalConfig returns the temporal config

func (*Config) GetTemporalEncryptionKey

func (c *Config) GetTemporalEncryptionKey() string

GetTemporalEncryptionKey returns the encryption key for Temporal

func (*Config) GetTemporalEncryptionKeyPath

func (c *Config) GetTemporalEncryptionKeyPath() string

GetTemporalEncryptionKeyPath returns the path for file containing data encryption key for Temporal

func (*Config) GetTemporalHost

func (c *Config) GetTemporalHost() string

GetTemporalHost returns the hostname for Temporal

func (*Config) GetTemporalKeyPath

func (c *Config) GetTemporalKeyPath() string

GetTemporalKeyPath returns the path for client key for Temporal

func (*Config) GetTemporalNamespace

func (c *Config) GetTemporalNamespace() string

GetTemporalNamespace returns the namespace for Temporal

func (*Config) GetTemporalPort

func (c *Config) GetTemporalPort() int

GetTemporalPort returns the port for Temporal

func (*Config) GetTemporalQueue

func (c *Config) GetTemporalQueue() string

GetTemporalQueue returns the queue for Temporal

func (*Config) GetTemporalServerName

func (c *Config) GetTemporalServerName() string

GetTemporalServerName returns the server name for Temporal

func (*Config) GetTemporalTlsEnabled

func (c *Config) GetTemporalTlsEnabled() bool

GetTemporalTlsEnabled returns true if TLS is enabled for Temporal connection

func (*Config) GetTracingEnabled

func (c *Config) GetTracingEnabled() bool

GetTracingEnabled gets the enabled field for tracing

func (*Config) GetTracingServiceName

func (c *Config) GetTracingServiceName() string

GetTracingServiceName gets the service name for tracing

func (*Config) SetNgcAPIBaseURL

func (c *Config) SetNgcAPIBaseURL(value string)

SetNgcAPIBaseURL sets the base url for the ngc api

func (*Config) SetNotificationsSlackWebhookURL

func (c *Config) SetNotificationsSlackWebhookURL(value string)

SetNotificationsSlackWebhookURL sets the slack webhook url

func (*Config) SetSiteManagerEndpoint

func (c *Config) SetSiteManagerEndpoint(value string)

SetSiteManagerEndpoint sets the endpoint

func (*Config) SetTemporalCaPath

func (c *Config) SetTemporalCaPath(value string)

SetTemporalCaPath sets the path for ca for Temporal

func (*Config) SetTemporalCertPath

func (c *Config) SetTemporalCertPath(value string)

SetTemporalCertPath set the path for client cert for Temporal

func (*Config) SetTemporalEncryptionKey

func (c *Config) SetTemporalEncryptionKey()

SetTemporalEncryptionKey sets the encryption key for Temporal

func (*Config) SetTemporalEncryptionKeyPath

func (c *Config) SetTemporalEncryptionKeyPath(value string)

SetTemporalEncryptionKeyPath sets the path for file containing data encryption key for Temporal

func (*Config) SetTemporalKeyPath

func (c *Config) SetTemporalKeyPath(value string)

SetTemporalKeyPath set the path for client key for Temporal

func (*Config) Validate

func (c *Config) Validate()

Validate validates the config

func (*Config) WatchSecretFilePaths

func (c *Config) WatchSecretFilePaths()

WatchSecretFilePaths starts watching secret files for changes.

type HealthzConfig

type HealthzConfig struct {
	Enabled bool
	Port    int
}

HealthzConfig holds configuration of Healthz

func NewHealthzConfig

func NewHealthzConfig(enabled bool, port int) *HealthzConfig

NewHealthzConfig initializes and returns a configuration object for managing Healthz

func (*HealthzConfig) GetListenAddr

func (hccfg *HealthzConfig) GetListenAddr() string

GetListenAddr returns the local address for listen socket.

type MetricsConfig

type MetricsConfig struct {
	Enabled   bool
	Port      int
	Namespace string
}

MetricsConfig holds configuration of Metrics

func NewMetricsConfig

func NewMetricsConfig(enabled bool, port int, namespace string) *MetricsConfig

NewMetricsConfig initializes and returns a configuration object for managing Metrics

func (*MetricsConfig) GetListenAddr

func (mcfg *MetricsConfig) GetListenAddr() string

GetListenAddr returns the local address for listen socket.

Jump to

Keyboard shortcuts

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