settings

package
v0.5.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DeployerHttpProxy indicates the address for proxying none SSL http outbound traffic used by deployer,
	// it's in form of http(s)://[user:password@]address[:port].
	DeployerHttpProxy = newValue(
		"DeployerHttpProxy",
		editable,
		initializeFromSpecifiedEnv("HTTP_PROXY", ""),
		modifyWith(httpUrl),
	)
	// DeployerHttpsProxy indicates the address for proxying SSL http outbound traffic used by deployer,
	// it's in form of http(s)://[user:password@]address[:port].
	DeployerHttpsProxy = newValue(
		"DeployerHttpsProxy",
		editable,
		initializeFromSpecifiedEnv("HTTPS_PROXY", ""),
		modifyWith(httpUrl),
	)
	// DeployerAllProxy indicates the address for proxying outbound traffic used by deployer,
	// it's in form of scheme://[user:password@]address[:port].
	DeployerAllProxy = newValue(
		"DeployerAllProxy",
		editable,
		initializeFromSpecifiedEnv("ALL_PROXY", ""),
		modifyWith(sockUrl),
	)
	// DeployerNoProxy indicates the host exclusion list when proxying outbound traffic used by deployer,
	// it's a comma-separated string.
	DeployerNoProxy = newValue(
		"DeployerNoProxy",
		editable,
		initializeFromSpecifiedEnv("NO_PROXY", ""),
		nil)
	// DeployerImage indicates the image used by deployer.
	DeployerImage = newValue(
		"DeployerImage",
		editable,

		initializeFromEnv("sealio/terraform-deployer:v1.5.7-seal.1"),
		modifyWith(notBlank, containerImageReference),
	)
	// DeployerNetworkMirrorUrl indicates the URL to configure the network mirror for deployer.
	DeployerNetworkMirrorUrl = newValue(
		"DeployerNetworkMirrorUrl",
		editable,
		initializeFromEnv(""),
		modifyWith(httpUrl),
	)
	// WorkflowStepServiceImage indicates the image used by workflow step service.
	WorkflowStepServiceImage = newValue(
		"WorkflowStepServiceImage",
		editable,

		initializeFromEnv("sealio/curl-jq:v0.0.1"),
		modifyWith(notBlank, containerImageReference),
	)
)

the built-in settings for deployer.

View Source
var (
	// BootPwdGainSource indicates the bootstrap password provision mode.
	BootPwdGainSource = newValue(
		"BootPwdGainSource",
		hidden,
		initializeFrom("Invalid"),
		nil)
	// CasdoorCred keeps the AK/SK for accessing Casdoor server.
	CasdoorCred = newValue(
		"CasdoorCred",
		private,
		initializeFromJSON(casdoor.ApplicationCredential{}),
		modifyWith(once),
	)
	// CasdoorApiToken keeps the token for accessing Casdoor server.
	CasdoorApiToken = newValue(
		"CasdoorApiToken",
		private,
		nil,
		nil)
	// ServeUrl keeps the URL for accessing server.
	ServeUrl = newValue(
		"ServeUrl",
		editable,
		nil,
		modifyWith(notBlank, httpUrl))
	// ServeUiIndex keeps the address for serving UI.
	ServeUiIndex = newValue(
		"ServeUiIndex",
		editable|hidden,
		initializeFromEnv("https://walrus-ui-1303613262.cos.ap-guangzhou.myqcloud.com/latest/index.html"),
		modifyWith(notBlank, anyUrl),
	)
	// DataEncryptionSentry keeps the sentry for indicating whether enables data encryption.
	DataEncryptionSentry = newValue(
		"DataEncryptionSentry",
		private,
		nil,
		modifyWith(notBlank))
	// AuthsEncryptionAesGcmKey keeps the key for encrypting public token value with AES-GCM algorithm.
	AuthsEncryptionAesGcmKey = newValue(
		"AuthsEncryptionAesGcmKey",
		private,
		initializeFrom(strs.Hex(32)),
		modifyWith(never))
	// OpenAiApiToken keeps the openAI API token for generating module completions.
	// TODO protect the stored token.
	OpenAiApiToken = newValue(
		"OpenAiApiToken",
		editable|sensitive,
		nil,
		nil)
	// InstallationUUID keeps the uuid for installation.
	InstallationUUID = newValue(
		"InstallationUUID",
		private,
		initializeFrom(strs.Hex(16)),
		modifyWith(never))
	// EnableTelemetry keeps the user config for enable telemetry or not.
	EnableTelemetry = newValue(
		"EnableTelemetry",
		editable,
		initializeFromEnv("true"),
		modifyWith(notBlank))
	// EnableSyncCatalog keeps the user config for enable sync catalog or not.
	EnableSyncCatalog = newValue(
		"EnableSyncCatalog",
		editable,
		initializeFromEnv("true"),
		modifyWith(notBlank))
	// ImageRegistry config the image registry for seal tools, like finOps tools.
	ImageRegistry = newValue(
		"ImageRegistry",
		editable,
		initializeFromEnv("docker.io"),
		modifyWith(notBlank))
	EnableBuiltinCatalog = newValue(
		"EnableBuiltinCatalog",
		editable,
		initializeFromEnv("true"),
		modifyWith(notBlank))
	// SkipRemoteTLSVerify indicates whether skip SSL verification when accessing remote server.
	SkipRemoteTLSVerify = newValue(
		"SkipRemoteTLSVerify",
		editable,
		initializeFromEnv("false"),
		modifyWith(notBlank))
	// LocalEnvironmentMode indicates mode for setting up a local environment in the default project.
	LocalEnvironmentMode = newValue(
		"LocalEnvironmentMode",
		private,
		initializeFromEnv("kubernetes"),
		modifyWith(never))
	// WalrusFileHubURL keeps the address for Walrus file hub.
	WalrusFileHubURL = newValue(
		"WalrusFileHubURL",
		private,
		initializeFromEnv("https://github.com/seal-io/walrus-file-hub"),
		modifyWith(notBlank, anyUrl),
	)
)

the built-in settings for server.

View Source
var (
	// ConnectorCostCollectCronExpr indicates the cron expression of collect cost data,
	// default cron expression means executing collection per hour,
	// the cron expression is in form of `Seconds Minutes Hours DayOfMonth Month DayOfWeek`.
	ConnectorCostCollectCronExpr = newValue(
		"ConnectorCostCollectCronExpr",
		editable,
		initializeFromEnv("0 0 * ? * *"),
		modifyWith(notBlank, cronExpression),
	)
	// ConnectorStatusSyncCronExpr indicates the cron expression of sync connector status,
	// default cron expression means executing check every 5 minutes.
	ConnectorStatusSyncCronExpr = newValue(
		"ConnectorStatusSyncCronExpr",
		editable,
		initializeFromEnv("0 */5 * ? * *"),
		modifyWith(notBlank, cronExpression),
	)
	// ResourceComponentStatusSyncCronExpr indicates the cron expression of sync resource component status,
	// default cron expression means stating every 1 minute.
	ResourceComponentStatusSyncCronExpr = newValue(
		"ResourceComponentStatusSyncCronExpr",
		editable,
		initializeFromEnv("0 */1 * ? * *"),
		modifyWith(notBlank, cronExpression),
	)
	// ResourceComponentLabelApplyCronExpr indicates the cron expression of set labels to resource component,
	// default cron expression means setting every 2 minutes.
	ResourceComponentLabelApplyCronExpr = newValue(
		"ResourceComponentLabelApplyCronExpr",
		editable,
		initializeFromEnv("0 */2 * ? * *"),
		modifyWith(notBlank, cronExpression),
	)
	// ResourceComponentsDiscoverCronExpr indicates the cron expression of discover resource component basics,
	// default cron expression means discovering every 1 minute.
	ResourceComponentsDiscoverCronExpr = newValue(
		"ResourceComponentsDiscoverCronExpr",
		editable,
		initializeFromEnv("0 */1 * ? * *"),
		modifyWith(notBlank, cronExpression),
	)
	// TokenDeploymentExpiredCleanCronExpr indicates the cron expression of clean expired deployment token,
	// default cron expression means cleaning up every 30 minutes.
	TokenDeploymentExpiredCleanCronExpr = newValue(
		"TokenDeploymentExpiredCleanCronExpr",
		hidden,
		initializeFrom("0 */30 * ? * *"),
		modifyWith(notBlank, cronExpression),
	)
	// ResourceRelationshipCheckCronExpr indicates the cron expression of deploy scheduled resource,
	// default cron expression means deploying every 30 seconds.
	ResourceRelationshipCheckCronExpr = newValue(
		"ResourceRelationshipCheckCronExpr",
		editable,
		initializeFromEnv("*/30 * * ? * *"),
		modifyWith(notBlank, cronExpression),
	)
	// TelemetryPeriodicReportCronExpr indicates the cron expression of telemetry synchronization event,
	// default cron expression means sync at 2 o'clock evey day.
	TelemetryPeriodicReportCronExpr = newValue(
		"TelemetryPeriodicReportCronExpr",
		private,
		initializeFrom("0 0 2 * * *"),
		modifyWith(notBlank, cronExpression),
	)
	// CatalogTemplateSyncCronExpr indicates the cron expression of catalog template synchronization event,
	// default cron expression means sync at 1 o'clock evey day, and new cron must be at least 30 minutes.
	CatalogTemplateSyncCronExpr = newValue(
		"CatalogTemplateSyncCronExpr",
		private,
		initializeFrom("0 0 1 * * *"),
		modifyWith(notBlank, cronExpression, cronAtLeast(30*time.Minute)),
	)
)

the built-in settings for server cron jobs.

Functions

func All

func All() (r model.Settings)

All returns all settings.

func ForEach

func ForEach(input func(setting model.Setting) error) error

ForEach iterates each setting in input.

Types

type Value

type Value interface {
	// Name returns the name of the setting.
	Name() string

	// Value returns the value of the setting.
	Value(context.Context, model.ClientSet) (string, error)

	// ShouldValue likes Value but without error return,
	// it's good for error-insensitive cases and nice for chain calls.
	ShouldValue(context.Context, model.ClientSet) string

	// ValueJSONUnmarshal unmarshal the setting value into the given holder.
	ValueJSONUnmarshal(context.Context, model.ClientSet, any) error

	// ValueBool returns the bool value of the setting.
	ValueBool(context.Context, model.ClientSet) (bool, error)

	// ShouldValueBool likes ValueBool but without error return,
	// it's good for error-insensitive cases and nice for chain calls.
	ShouldValueBool(context.Context, model.ClientSet) bool

	// ValueInt64 returns the int64 value of the setting.
	ValueInt64(context.Context, model.ClientSet) (int64, error)

	// ShouldValueInt64 likes ValueInt64 but without error return,
	// it's good for error-insensitive cases and nice for chain calls.
	ShouldValueInt64(context.Context, model.ClientSet) int64

	// ValueUint64 returns the uint64 value of the setting.
	ValueUint64(context.Context, model.ClientSet) (uint64, error)

	// ShouldValueUint64 likes ValueUint64 but without error return,
	// it's good for error-insensitive cases and nice for chain calls.
	ShouldValueUint64(context.Context, model.ClientSet) uint64

	// ValueURL returns the url value of the setting.
	ValueURL(context.Context, model.ClientSet) (*url.URL, error)

	// ShouldValueURL likes ValueURL but without error return,
	// it's good for error-insensitive cases and nice for chain calls.
	ShouldValueURL(context.Context, model.ClientSet) *url.URL

	// Set configures the value of the setting.
	Set(context.Context, model.ClientSet, any) error

	// Cas configures the value of setting with CAS operation.
	Cas(context.Context, model.ClientSet, func(oldVal string) (newVal string, err error)) error
}

Value defines the operations of a built-in setting.

func Index

func Index(name string) Value

Index returns the setting with the given name.

Jump to

Keyboard shortcuts

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