configflags

package
v1.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const FeatureDeprecatedMessage = "This feature has been deprecated and is no longer " +
	"functional. The flag has no effect and can be safely removed."

Variables

View Source
var AllowListLocalPathsFlags = []Definition{
	{
		FlagName:             "allow-listed-local-paths",
		ConfigPath:           types.ComputeAllowListedLocalPathsKey,
		DefaultValue:         config.Default.Compute.AllowListedLocalPaths,
		Description:          "Local paths that are allowed to be mounted into jobs",
		EnvironmentVariables: []string{"BACALHAU_NODE_ALLOWLISTEDLOCALPATHS"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.ComputeAllowListedLocalPathsKey),
	},
}
View Source
var CapacityFlags = []Definition{

	{
		FlagName:             "limit-total-cpu",
		ConfigPath:           types.ComputeAllocatedCapacityCPUKey,
		DefaultValue:         config.Default.Compute.AllocatedCapacity.CPU,
		Description:          `Total CPU core limit to run all jobs (e.g. 500m, 2, 8, 80%, 10%).`,
		Deprecated:           true,
		EnvironmentVariables: []string{"BACALHAU_NODE_COMPUTE_CAPACITY_TOTALRESOURCELIMITS_CPU"},
		DeprecatedMessage:    makeDeprecationMessage(types.ComputeAllocatedCapacityCPUKey),
	},
	{
		FlagName:             "limit-total-memory",
		ConfigPath:           types.ComputeAllocatedCapacityMemoryKey,
		DefaultValue:         config.Default.Compute.AllocatedCapacity.Memory,
		Description:          `Total Memory limit to run all jobs  (e.g. 500Mb, 2Gb, 8Gb, 80%, 10%).`,
		Deprecated:           true,
		EnvironmentVariables: []string{"BACALHAU_NODE_COMPUTE_CAPACITY_TOTALRESOURCELIMITS_MEMORY"},
		DeprecatedMessage:    makeDeprecationMessage(types.ComputeAllocatedCapacityMemoryKey),
	},
	{
		FlagName:             "limit-total-gpu",
		ConfigPath:           types.ComputeAllocatedCapacityGPUKey,
		DefaultValue:         config.Default.Compute.AllocatedCapacity.GPU,
		Description:          `Total GPU limit to run all jobs (e.g. 1, 2, 80%, 10%).`,
		Deprecated:           true,
		EnvironmentVariables: []string{"BACALHAU_NODE_COMPUTE_CAPACITY_TOTALRESOURCELIMITS_GPU"},
		DeprecatedMessage:    makeDeprecationMessage(types.ComputeAllocatedCapacityGPUKey),
	},

	{
		FlagName:             "ignore-physical-resource-limits",
		ConfigPath:           "ignore.physical.resource.limits.deprecated",
		Description:          `When set the compute node will ignore is physical resource limits`,
		EnvironmentVariables: []string{"BACALHAU_CAPACITY_MANAGER_OVER_COMMIT", "BACALHAU_NODE_COMPUTE_CAPACITY_IGNOREPHYSICALRESOURCELIMITS"},
		DefaultValue:         "",
		Deprecated:           true,
		DeprecatedMessage:    FeatureDeprecatedMessage,
	},
	{
		FlagName:          "limit-job-cpu",
		ConfigPath:        "limit.job.cpu.deprecated",
		DefaultValue:      "",
		Deprecated:        true,
		DeprecatedMessage: FeatureDeprecatedMessage,
	},
	{
		FlagName:          "limit-job-memory",
		ConfigPath:        "limit.job.memory.deprecated",
		DefaultValue:      "",
		Deprecated:        true,
		DeprecatedMessage: FeatureDeprecatedMessage,
	},
	{
		FlagName:          "limit-job-disk",
		ConfigPath:        "limit.job.disk.deprecated",
		DefaultValue:      "",
		Deprecated:        true,
		DeprecatedMessage: FeatureDeprecatedMessage,
	},
	{
		FlagName:          "limit-job-gpu",
		ConfigPath:        "limit.job.gpu.deprecated",
		DefaultValue:      "",
		Deprecated:        true,
		DeprecatedMessage: FeatureDeprecatedMessage,
	},
}
View Source
var ClientAPIFlags = []Definition{
	{
		FlagName:     "api-host",
		DefaultValue: config.Default.API.Host,
		ConfigPath:   types.APIHostKey,
		Description: `The host for the client and server to communicate on (via REST).
Ignored if BACALHAU_API_HOST environment variable is set.`,
		EnvironmentVariables: []string{"BACALHAU_API_HOST"},
	},
	{
		FlagName:     "api-port",
		DefaultValue: config.Default.API.Port,
		ConfigPath:   types.APIPortKey,
		Description: `The port for the client and server to communicate on (via REST).
Ignored if BACALHAU_API_PORT environment variable is set.`,
		EnvironmentVariables: []string{"BACALHAU_API_PORT"},
	},
	{
		FlagName:             "tls",
		DefaultValue:         config.Default.API.TLS.UseTLS,
		ConfigPath:           types.APITLSUseTLSKey,
		Description:          `Instructs the client to use TLS`,
		EnvironmentVariables: []string{"BACALHAU_API_TLS"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.APITLSUseTLSKey),
	},
	{
		FlagName:     "cacert",
		DefaultValue: config.Default.API.TLS.CAFile,
		ConfigPath:   types.APITLSCAFileKey,
		Description: `The location of a CA certificate file when self-signed certificates
	are used by the server`,
		EnvironmentVariables: []string{"BACALHAU_API_CACERT"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.APITLSCAFileKey),
	},
	{
		FlagName:             "insecure",
		DefaultValue:         config.Default.API.TLS.Insecure,
		ConfigPath:           types.APITLSInsecureKey,
		Description:          `Enables TLS but does not verify certificates`,
		EnvironmentVariables: []string{"BACALHAU_API_INSECURE"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.APITLSInsecureKey),
	},
}
View Source
var ComputeFlags = []Definition{
	{
		FlagName:     "compute",
		ConfigPath:   types.ComputeEnabledKey,
		DefaultValue: config.Default.Compute.Enabled,
		Description:  "When true the compute service will be enabled.",
	},
}
View Source
var ComputeStorageFlags = []Definition{
	{
		FlagName:          "compute-execution-store-type",
		ConfigPath:        "compute.execution.store.type.deprecated",
		DefaultValue:      "",
		Deprecated:        true,
		DeprecatedMessage: "type is no longer configurable. bacalhau uses BoltDB",
	},
	{
		FlagName:          "compute-execution-store-path",
		ConfigPath:        "compute.execution.store.path.deprecated",
		DefaultValue:      "",
		Deprecated:        true,
		DeprecatedMessage: "path is no longer configurable. location $BACALHAU_DIR/compute/state_boltdb.db",
	},
}

deprecated

View Source
var ComputeTimeoutFlags = []Definition{
	{
		FlagName:          "job-execution-timeout-bypass-client-id",
		ConfigPath:        "job.execution.timeout.bypass.client.id.deprecated",
		DefaultValue:      "",
		Deprecated:        true,
		DeprecatedMessage: FeatureDeprecatedMessage,
	},
	{
		FlagName:          "job-negotiation-timeout",
		ConfigPath:        "job.negotiation.timeout.deprecated",
		DefaultValue:      "",
		Deprecated:        true,
		DeprecatedMessage: FeatureDeprecatedMessage,
	},
	{
		FlagName:          "min-job-execution-timeout",
		ConfigPath:        "min.job.execution.timeout.deprecated",
		DefaultValue:      "",
		Deprecated:        true,
		DeprecatedMessage: FeatureDeprecatedMessage,
	},
	{
		FlagName:          "max-job-execution-timeout",
		ConfigPath:        "max.job.execution.timeout.deprecated",
		DefaultValue:      "",
		Deprecated:        true,
		DeprecatedMessage: FeatureDeprecatedMessage,
	},
	{
		FlagName:     "default-job-execution-timeout",
		ConfigPath:   "default.job.execution.timeout.deprecated",
		DefaultValue: "",
		Deprecated:   true,
		DeprecatedMessage: fmt.Sprintf("Use one or more of the following options, all are accepted %s, %s",
			makeConfigFlagDeprecationCommand(types.JobDefaultsBatchTaskTimeoutsExecutionTimeoutKey),
			makeConfigFlagDeprecationCommand(types.JobDefaultsOpsTaskTimeoutsExecutionTimeoutKey),
		),
	},
}

deprecated

View Source
var DataDirFlag = []Definition{
	{
		FlagName:             "repo",
		ConfigPath:           types.DataDirKey,
		DefaultValue:         config.Default.DataDir,
		Description:          "The filesystem path bacalhau inits or opens a repo in",
		EnvironmentVariables: []string{"BACALHAU_DIR"},
		Deprecated:           true,
		DeprecatedMessage:    "Use --data-dir=<path> to set this configuration",
	},
	{
		FlagName:             "data-dir",
		ConfigPath:           types.DataDirKey,
		DefaultValue:         config.Default.DataDir,
		Description:          "The filesystem path bacalhau inits or opens a repo in",
		EnvironmentVariables: []string{"BACALHAU_DIR"},
	},
}
View Source
var DisabledFeatureFlags = []Definition{
	{
		FlagName:             "disable-engine",
		ConfigPath:           types.EnginesDisabledKey,
		DefaultValue:         config.Default.Engines.Disabled,
		Description:          "Engine types to disable",
		EnvironmentVariables: []string{"BACALHAU_NODE_DISABLEDFEATURES_ENGINES"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.EnginesDisabledKey),
	},
	{
		FlagName:             "disabled-publisher",
		ConfigPath:           types.PublishersDisabledKey,
		DefaultValue:         config.Default.Publishers.Disabled,
		Description:          "Publisher types to disable",
		Deprecated:           true,
		EnvironmentVariables: []string{"BACALHAU_NODE_DISABLEDFEATURES_PUBLISHERS"},
		DeprecatedMessage:    makeDeprecationMessage(types.PublishersDisabledKey),
	},
	{
		FlagName:             "disable-storage",
		ConfigPath:           types.InputSourcesDisabledKey,
		DefaultValue:         config.Default.InputSources.Disabled,
		Description:          "Storage types to disable",
		Deprecated:           true,
		EnvironmentVariables: []string{"BACALHAU_NODE_DISABLEDFEATURES_STORAGES"},
		DeprecatedMessage:    makeDeprecationMessage(types.InputSourcesDisabledKey),
	},
}
View Source
var DockerManifestCacheFlags = []Definition{
	{
		FlagName:             "docker-manifest-cache-size",
		ConfigPath:           types.EnginesTypesDockerManifestCacheSizeKey,
		DefaultValue:         config.Default.Engines.Types.Docker.ManifestCache.Size,
		Description:          `Specifies the number of items that can be held in the manifest cache`,
		EnvironmentVariables: []string{"BACALHAU_DOCKER_MANIFEST_CACHE_SIZE"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.EnginesTypesDockerManifestCacheSizeKey),
	},
	{
		FlagName:             "docker-manifest-cache-duration",
		ConfigPath:           types.EnginesTypesDockerManifestCacheTTLKey,
		DefaultValue:         config.Default.Engines.Types.Docker.ManifestCache.TTL,
		Description:          `The default time-to-live for each record in the manifest cache`,
		EnvironmentVariables: []string{"BACALHAU_DOCKER_MANIFEST_CACHE_DURATION"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.EnginesTypesDockerManifestCacheTTLKey),
	},
	{
		FlagName:             "docker-manifest-cache-frequency",
		ConfigPath:           types.EnginesTypesDockerManifestCacheRefreshKey,
		DefaultValue:         config.Default.Engines.Types.Docker.ManifestCache.Refresh,
		Description:          `The frequency that the checks for stale records is performed`,
		EnvironmentVariables: []string{"BACALHAU_DOCKER_MANIFEST_CACHE_FREQUENCY"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.EnginesTypesDockerManifestCacheRefreshKey),
	},
}
View Source
var IPFSFlags = []Definition{
	{
		FlagName:     "ipfs-connect",
		ConfigPath:   "ipfs.connect.deprecated",
		DefaultValue: "",
		Deprecated:   true,
		DeprecatedMessage: fmt.Sprintf("Use one or more of the following options, all are accepted %s, %s, %s",
			makeConfigFlagDeprecationCommand(types.InputSourcesTypesIPFSEndpointKey),
			makeConfigFlagDeprecationCommand(types.PublishersTypesIPFSEndpointKey),
			makeConfigFlagDeprecationCommand(types.ResultDownloadersTypesIPFSEndpointKey),
		),
	},
	{
		FlagName:     "ipfs-connect-storage",
		ConfigPath:   types.InputSourcesTypesIPFSEndpointKey,
		DefaultValue: config.Default.InputSources.Types.IPFS.Endpoint,
		Description: "The ipfs host multiaddress to connect to for inputs, " +
			"otherwise an in-process IPFS node will be created if not set.",
		EnvironmentVariables: []string{"BACALHAU_NODE_IPFS_CONNECT"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.InputSourcesTypesIPFSEndpointKey),
	},
	{
		FlagName:     "ipfs-connect-publisher",
		ConfigPath:   types.PublishersTypesIPFSEndpointKey,
		DefaultValue: config.Default.Publishers.Types.IPFS.Endpoint,
		Description: "The ipfs host multiaddress to connect to for publishing, " +
			"otherwise an in-process IPFS node will be created if not set.",
		EnvironmentVariables: []string{"BACALHAU_NODE_IPFS_CONNECT"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.PublishersTypesIPFSEndpointKey),
	},
	{
		FlagName:     "ipfs-connect-downloader",
		ConfigPath:   types.ResultDownloadersTypesIPFSEndpointKey,
		DefaultValue: config.Default.ResultDownloaders.Types.IPFS.Endpoint,
		Description: "The ipfs host multiaddress to connect to for downloading, " +
			"otherwise an in-process IPFS node will be created if not set.",
		EnvironmentVariables: []string{"BACALHAU_NODE_IPFS_CONNECT"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.ResultDownloadersTypesIPFSEndpointKey),
	},
}
View Source
var JobSelectionFlags = []Definition{
	{
		FlagName:          "job-selection-data-locality",
		ConfigPath:        "job.selection.data.locality.deprecated",
		DefaultValue:      "",
		Deprecated:        true,
		DeprecatedMessage: FeatureDeprecatedMessage,
	},
	{
		FlagName:             "job-selection-reject-stateless",
		ConfigPath:           types.JobAdmissionControlRejectStatelessJobsKey,
		DefaultValue:         config.Default.JobAdmissionControl.RejectStatelessJobs,
		Description:          `Reject jobs that don't specify any data.`,
		Deprecated:           true,
		EnvironmentVariables: []string{"BACALHAU_NODE_COMPUTE_JOBSELECTION_REJECTSTATELESSJOBS"},
		DeprecatedMessage:    makeDeprecationMessage(types.JobAdmissionControlRejectStatelessJobsKey),
	},
	{
		FlagName:             "job-selection-accept-networked",
		ConfigPath:           types.JobAdmissionControlAcceptNetworkedJobsKey,
		DefaultValue:         config.Default.JobAdmissionControl.AcceptNetworkedJobs,
		Description:          `Accept jobs that require network access.`,
		Deprecated:           true,
		EnvironmentVariables: []string{"BACALHAU_NODE_COMPUTE_JOBSELECTION_ACCEPTNETWORKEDJOBS"},
		DeprecatedMessage:    makeDeprecationMessage(types.JobAdmissionControlAcceptNetworkedJobsKey),
	},
	{
		FlagName:             "job-selection-probe-http",
		ConfigPath:           types.JobAdmissionControlProbeHTTPKey,
		DefaultValue:         config.Default.JobAdmissionControl.ProbeHTTP,
		Description:          `Use the result of a HTTP POST to decide if we should take on the job.`,
		Deprecated:           true,
		EnvironmentVariables: []string{"BACALHAU_NODE_COMPUTE_JOBSELECTION_PROBEHTTP"},
		DeprecatedMessage:    makeDeprecationMessage(types.JobAdmissionControlProbeHTTPKey),
	},
	{
		FlagName:             "job-selection-probe-exec",
		ConfigPath:           types.JobAdmissionControlProbeExecKey,
		DefaultValue:         config.Default.JobAdmissionControl.ProbeExec,
		Description:          `Use the result of a exec an external program to decide if we should take on the job.`,
		Deprecated:           true,
		EnvironmentVariables: []string{"BACALHAU_NODE_COMPUTE_JOBSELECTION_PROBEEXEC"},
		DeprecatedMessage:    makeDeprecationMessage(types.JobAdmissionControlProbeExecKey),
	},
}
View Source
var JobTranslationFlags = []Definition{
	{
		FlagName:          "requester-job-translation-enabled",
		ConfigPath:        legacy_types.NodeRequesterTranslationEnabled,
		DefaultValue:      false,
		Deprecated:        true,
		DeprecatedMessage: "job translation was an experimental feature and is no longer supported",
	},
}
View Source
var LabelFlags = []Definition{
	{
		FlagName:     "labels",
		ConfigPath:   types.LabelsKey,
		DefaultValue: config.Default.Labels,

		Description:          `Labels to be associated with the node that can be used for node selection and filtering. (e.g. --labels key1=value1,key2=value2)`,
		Deprecated:           true,
		EnvironmentVariables: []string{"BACALHAU_NODE_LABELS"},
		DeprecatedMessage:    makeDeprecationMessage(types.LabelsKey),
	},
}
View Source
var LocalPublisherFlags = []Definition{
	{
		FlagName:             "local-publisher-address",
		DefaultValue:         config.Default.Publishers.Types.Local.Address,
		ConfigPath:           types.PublishersTypesLocalAddressKey,
		EnvironmentVariables: []string{"BACALHAU_NODE_COMPUTE_LOCALPUBLISHER_ADDRESS"},
		Description:          `The address for the local publisher's server to bind to.`,
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.PublishersTypesLocalAddressKey),
	},
	{
		FlagName:             "local-publisher-port",
		DefaultValue:         config.Default.Publishers.Types.Local.Port,
		ConfigPath:           types.PublishersTypesLocalPortKey,
		Description:          `The port for the local publisher's server to bind to.`,
		EnvironmentVariables: []string{"BACALHAU_NODE_COMPUTE_LOCALPUBLISHER_PORT"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.PublishersTypesLocalPortKey),
	},
	{
		FlagName:          "local-publisher-directory",
		Deprecated:        true,
		DefaultValue:      "",
		DeprecatedMessage: FeatureDeprecatedMessage,
	},
}
View Source
var LogFlags = []Definition{
	{
		FlagName:          "log-mode",
		DefaultValue:      config.Default.Logging.Mode,
		ConfigPath:        types.LoggingModeKey,
		Description:       `Log format: 'default','station','json','combined','event'`,
		Deprecated:        true,
		DeprecatedMessage: makeDeprecationMessage(types.LoggingModeKey),
	},
	{
		FlagName:             "log-level",
		DefaultValue:         config.Default.Logging.Level,
		ConfigPath:           types.LoggingLevelKey,
		Description:          `Log level: 'trace', 'debug', 'info', 'warn', 'error', 'fatal', 'panic'`,
		EnvironmentVariables: []string{"LOG_LEVEL"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.LoggingLevelKey),
	},
}
View Source
var NetworkFlags = []Definition{
	{
		FlagName:     "orchestrator",
		ConfigPath:   types.OrchestratorEnabledKey,
		DefaultValue: config.Default.Orchestrator.Enabled,
		Description:  "When true the orchestrator service will be enabled.",
	},
	{
		FlagName:          "requester",
		ConfigPath:        types.OrchestratorEnabledKey,
		DefaultValue:      config.Default.Orchestrator.Enabled,
		Description:       "When true the orchestrator service will be enabled.",
		Deprecated:        true,
		DeprecatedMessage: makeDeprecationMessage(types.OrchestratorEnabledKey),
	},
	{
		FlagName:          "network-host",
		ConfigPath:        types.OrchestratorHostKey,
		DefaultValue:      config.Default.Orchestrator.Host,
		Description:       `Host to listen for connections from other nodes. Applies to orchestrator nodes.`,
		Deprecated:        true,
		DeprecatedMessage: makeDeprecationMessage(types.OrchestratorHostKey),
	},
	{
		FlagName:             "network-port",
		ConfigPath:           types.OrchestratorPortKey,
		DefaultValue:         config.Default.Orchestrator.Port,
		EnvironmentVariables: []string{"BACALHAU_NODE_NETWORK_PORT"},
		Description:          `Port to listen for connections from other nodes. Applies to orchestrator nodes.`,
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.OrchestratorPortKey),
	},
	{
		FlagName:             "orchestrators",
		ConfigPath:           types.ComputeOrchestratorsKey,
		DefaultValue:         config.Default.Compute.Orchestrators,
		Description:          `Comma-separated list of orchestrators to connect to. Applies to compute nodes.`,
		EnvironmentVariables: []string{"BACALHAU_NODE_NETWORK_ORCHESTRATORS"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.ComputeOrchestratorsKey),
	},
	{
		FlagName:             "advertised-address",
		ConfigPath:           types.OrchestratorAdvertiseKey,
		DefaultValue:         config.Default.Orchestrator.Advertise,
		Description:          `Address to advertise to compute nodes to connect to.`,
		EnvironmentVariables: []string{"BACALHAU_NODE_NETWORK_ADVERTISEDADDRESS"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.OrchestratorAdvertiseKey),
	},
	{
		FlagName:             "cluster-name",
		ConfigPath:           types.OrchestratorClusterNameKey,
		DefaultValue:         config.Default.Orchestrator.Cluster.Name,
		Description:          `Name of the cluster to join.`,
		Deprecated:           true,
		EnvironmentVariables: []string{"BACALHAU_NODE_NETWORK_CLUSTER_NAME"},
		DeprecatedMessage:    makeDeprecationMessage(types.OrchestratorClusterNameKey),
	},
	{
		FlagName:             "cluster-host",
		ConfigPath:           types.OrchestratorClusterHostKey,
		DefaultValue:         config.Default.Orchestrator.Cluster.Host,
		Description:          `Address to listen for connections from other orchestrators to form a cluster.`,
		EnvironmentVariables: []string{"BACALHAU_NODE_NETWORK_CLUSTER_HOST"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.OrchestratorClusterHostKey),
	},
	{
		FlagName:             "cluster-port",
		ConfigPath:           types.OrchestratorClusterPortKey,
		DefaultValue:         config.Default.Orchestrator.Cluster.Port,
		Description:          `Port to listen for connections from other orchestrators to form a cluster.`,
		EnvironmentVariables: []string{"BACALHAU_NODE_NETWORK_CLUSTER_PORT"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.OrchestratorClusterPortKey),
	},
	{
		FlagName:             "cluster-advertised-address",
		ConfigPath:           types.OrchestratorClusterAdvertiseKey,
		DefaultValue:         config.Default.Orchestrator.Cluster.Advertise,
		Description:          `Address to advertise to other orchestrators to connect to.`,
		EnvironmentVariables: []string{"BACALHAU_NODE_NETWORK_CLUSTER_ADVERTISEADDRESS"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.OrchestratorClusterAdvertiseKey),
	},
	{
		FlagName:             "cluster-peers",
		ConfigPath:           types.OrchestratorClusterPeersKey,
		DefaultValue:         config.Default.Orchestrator.Cluster.Peers,
		Description:          `Comma-separated list of other orchestrators to connect to to form a cluster.`,
		EnvironmentVariables: []string{"BACALHAU_NODE_NETWORK_CLUSTER_PEERS"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.OrchestratorClusterPeersKey),
	},

	{
		FlagName:          "network-store-dir",
		ConfigPath:        "network.store.deprecated",
		DefaultValue:      "",
		Description:       `Directory that network can use for storage`,
		Deprecated:        true,
		DeprecatedMessage: "network path is no longer configurable, location: $BACALHAU_DIR/orchestrator/nats-store",
	},
}
View Source
var NodeInfoStoreFlags = []Definition{
	{
		FlagName:          "node-info-store-ttl",
		ConfigPath:        "node.info.store.ttl.deprecated",
		DefaultValue:      "",
		Deprecated:        true,
		DeprecatedMessage: FeatureDeprecatedMessage,
	},
}

deprecated

View Source
var NodeNameFlags = []Definition{
	{
		FlagName:             "name-provider",
		ConfigPath:           types.NameProviderKey,
		DefaultValue:         config.Default.NameProvider,
		Description:          `The name provider to use to generate the node name when the node initializes.`,
		EnvironmentVariables: []string{"BACALHAU_NODE_NAMEPROVIDER"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.NameProviderKey),
	},
}
View Source
var NodeTypeFlags = []Definition{
	{
		FlagName:          "node-type",
		ConfigPath:        "node.type.deprecated",
		DefaultValue:      "",
		Deprecated:        true,
		DeprecatedMessage: "Use --orchestrator and/or --compute to set the node type.",
	},
}

deprecated

View Source
var PublishingFlags = []Definition{
	{
		FlagName:     "default-publisher",
		ConfigPath:   "default.publisher.deprecated",
		DefaultValue: "",
		Deprecated:   true,
		DeprecatedMessage: fmt.Sprintf("Use one or more of the following options, all are accepted %s, %s",
			makeConfigFlagDeprecationCommand(types.JobDefaultsBatchTaskPublisherTypeKey),
			makeConfigFlagDeprecationCommand(types.JobDefaultsOpsTaskPublisherTypeKey),
		),
	},
}

deprecated

View Source
var RequesterJobStorageFlags = []Definition{
	{
		FlagName:          "requester-job-store-type",
		ConfigPath:        "requester.job.store.type.deprecated",
		DefaultValue:      "",
		Deprecated:        true,
		DeprecatedMessage: "type is no longer configurable. bacalhau uses BoltDB",
	},
	{
		FlagName:          "requester-job-store-path",
		ConfigPath:        "requester.job.store.path.deprecated",
		DefaultValue:      "",
		Deprecated:        true,
		DeprecatedMessage: "path is no longer configurable. location $BACALHAU_DIR/orchestrator/state_boltdb.db",
	},
}

deprecated

View Source
var RequesterTLSFlags = []Definition{
	{
		FlagName:     "autocert",
		DefaultValue: config.Default.API.TLS.AutoCert,
		ConfigPath:   types.APITLSAutoCertKey,
		Description: `Specifies a host name for which ACME is used to obtain a TLS Certificate.
Using this option results in the API serving over HTTPS`,
		EnvironmentVariables: []string{"BACALHAU_AUTO_TLS"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.APITLSAutoCertKey),
	},
	{
		FlagName:             "tlscert",
		DefaultValue:         config.Default.API.TLS.CertFile,
		ConfigPath:           types.APITLSCertFileKey,
		Description:          `Specifies a TLS certificate file to be used by the requester node`,
		EnvironmentVariables: []string{"BACALHAU_TLS_CERT"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.APITLSCertFileKey),
	},
	{
		FlagName:             "tlskey",
		DefaultValue:         config.Default.API.TLS.KeyFile,
		ConfigPath:           types.APITLSKeyFileKey,
		Description:          `Specifies a TLS key file matching the certificate to be used by the requester node`,
		EnvironmentVariables: []string{"BACALHAU_TLS_KEY"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.APITLSKeyFileKey),
	},
	{
		FlagName:             "self-signed",
		DefaultValue:         config.Default.API.TLS.SelfSigned,
		ConfigPath:           types.APITLSSelfSignedKey,
		Description:          `Specifies whether to auto-generate a self-signed certificate for the requester node`,
		EnvironmentVariables: []string{"BACALHAU_TLS_SELFSIGNED"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.APITLSSelfSignedKey),
	},
}
View Source
var ServerAPIFlags = []Definition{
	{
		FlagName:             "port",
		DefaultValue:         config.Default.API.Port,
		ConfigPath:           types.APIPortKey,
		Description:          `The port to server on.`,
		EnvironmentVariables: []string{"BACALHAU_SERVER_PORT"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.APIPortKey),
	},
	{
		FlagName:             "host",
		DefaultValue:         config.Default.API.Host,
		ConfigPath:           types.APIHostKey,
		Description:          `The host to serve on.`,
		EnvironmentVariables: []string{"BACALHAU_SERVER_HOST"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.APIHostKey),
	},
}
View Source
var WebUIFlags = []Definition{
	{
		FlagName:          "web-ui",
		ConfigPath:        types.WebUIEnabledKey,
		DefaultValue:      config.Default.WebUI.Enabled,
		Description:       `Whether to start the web UI alongside the bacalhau node.`,
		Deprecated:        true,
		DeprecatedMessage: makeDeprecationMessage(types.WebUIEnabledKey),
	},
	{
		FlagName:          "web-ui-listen",
		ConfigPath:        types.WebUIListenKey,
		DefaultValue:      config.Default.WebUI.Listen,
		Description:       `The address to listen on for web-ui connections.`,
		Deprecated:        true,
		DeprecatedMessage: makeDeprecationMessage(types.WebUIListenKey),
	},
}

Functions

func BindFlags

func BindFlags(v *viper.Viper, register map[string][]Definition) error

func PreRun added in v1.1.2

func PreRun(v *viper.Viper, flags map[string][]Definition) func(*cobra.Command, []string) error

PreRun returns a run hook that binds the passed flag sets onto the command.

func RegisterFlags

func RegisterFlags(cmd *cobra.Command, register map[string][]Definition) error

RegisterFlags adds flags to the command based on provided definitions. This method should be called before the command runs to register flags accordingly.

Types

type Definition

type Definition struct {
	FlagName             string
	ConfigPath           string
	DefaultValue         interface{}
	Description          string
	EnvironmentVariables []string
	Deprecated           bool
	DeprecatedMessage    string
}

Definition serves as a bridge between Cobra's command-line flags and Viper's configuration management. Each instance of `Definition` maps a flag (as presented to the user via the CLI) to its corresponding configuration setting in Viper. Here's a breakdown:

  • FlagName: The name of the flag as it appears on the command line.
  • ConfigPath: The path/key used by Viper to store and retrieve the flag's value. This path can represent nested configuration settings. It is also the environment variable (replace '.' with '_')
  • DefaultValue: The default value for the flag, used both in Cobra (when the flag is not explicitly provided) and in Viper (as the initial configuration value).
  • Description: A human-readable description of the flag's purpose, shown in help messages and documentation.

By defining flags in this manner, we establish a clear and consistent pattern for integrating Cobra and Viper, ensuring that command-line interactions seamlessly reflect and influence the underlying configuration state.

Jump to

Keyboard shortcuts

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