configflags

package
v1.5.0-dev14 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 11 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:         types.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:         types.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:         types.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:         types.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: types.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: types.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:         types.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: types.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:         types.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: types.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:         types.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:         types.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:         types.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:         types.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:         types.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:         types.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:         types.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:         types.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:         types.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:         types.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:         types.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:         types.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:         types.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:         types.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:         types.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:           types.FeatureFlagsExecTranslationKey,
		DefaultValue:         types.Default.FeatureFlags.ExecTranslation,
		Description:          `Whether jobs should be translated at the requester node or not. Default: false`,
		Deprecated:           true,
		EnvironmentVariables: []string{"BACALHAU_NODE_REQUESTER_TRANSLATIONENABLED"},
		DeprecatedMessage:    makeDeprecationMessage(types.FeatureFlagsExecTranslationKey),
	},
}
View Source
var LabelFlags = []Definition{
	{
		FlagName:     "labels",
		ConfigPath:   types.ComputeLabelsKey,
		DefaultValue: types.Default.Compute.Labels,

		Description:          `Labels to be associated with the compute 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.ComputeLabelsKey),
	},
}
View Source
var LocalPublisherFlags = []Definition{
	{
		FlagName:             "local-publisher-address",
		DefaultValue:         types.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:         types.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",
		DefaultValue:         types.Default.Publishers.Types.Local.Directory,
		ConfigPath:           types.PublishersTypesLocalDirectoryKey,
		Description:          `The directory where the local publisher will store content.`,
		EnvironmentVariables: []string{"BACALHAU_NODE_COMPUTE_LOCALPUBLISHER_DIRECTORY"},
		Deprecated:           true,
		DeprecatedMessage:    makeDeprecationMessage(types.PublishersTypesLocalDirectoryKey),
	},
}
View Source
var LogFlags = []Definition{
	{
		FlagName:          "log-mode",
		DefaultValue:      types.Default.Logging.Mode,
		ConfigPath:        types.LoggingModeKey,
		Description:       `Log format: 'default','station','json','combined','event'`,
		Deprecated:        true,
		DeprecatedMessage: makeDeprecationMessage(types.LoggingModeKey),
	},
	{
		FlagName:             "log-level",
		DefaultValue:         types.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: types.Default.Orchestrator.Enabled,
		Description:  "When true the orchestrator service will be enabled.",
	},
	{
		FlagName:          "requester",
		ConfigPath:        types.OrchestratorEnabledKey,
		DefaultValue:      types.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:      types.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:         types.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:         types.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:         types.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:         types.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:         types.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:         types.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:         types.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:         types.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:         types.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.JobDefaultsOpsTaskPublisherParamsKey),
		),
	},
}

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: types.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:         types.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:         types.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:         types.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:         types.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:         types.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:      types.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:      types.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