- Command-line flags (
--domain example.com) - Environment variables (
BATON_DOMAIN=example.com) - A config file (YAML)
Standard flags (all connectors)
Every connector automatically has these flags through the SDK. Run./baton-yourservice --help to see the flags for a specific connector. Hidden flags don’t appear there.
Output and logging
Daemon mode
A connector runs in daemon mode when you set
--client-id, and it exits with an error unless you also set --client-secret. A connector that runs as a Windows service always runs in daemon mode.
Sync performance
Provisioning and operations
See Test provisioning locally for how to combine these flags.
Targeted sync
OpenTelemetry (operators)
Built-in subcommands
Every connector also has subcommands. Two are useful while you build:capabilitiesprints the capability manifest as JSON.configprints the configuration schema.
Environment variables
Every flag maps to an environment variable with theBATON_ prefix:
- The prefix is
BATON_. - Dashes become underscores:
--base-dnbecomesBATON_BASE_DN. - Use upper case. On systems with case-sensitive environment variables,
baton_domaindoesn’t match.
Config file format
Connectors read configuration from a YAML file:.baton.yaml in the current directory. To use a different file, set the BATON_CONFIG_PATH environment variable to its path. The file name must end in .yaml or .yml.
Define your configuration
You declare a connector’s configuration fields inpkg/config/config.go, group them into a field.Configuration, and pass that to config.RunConnector:
go generate (or make generate in a Starter Pack project) to create conf.gen.go. It defines a struct with one typed field for each configuration field, tagged with mapstructure:"<field-name>", and it satisfies the field.Configurable interface that RunConnector requires. Your connector constructor receives this struct. See Building connectors for the full setup.
field.NewConfiguration also accepts these options: WithConnectorDisplayName, WithHelpUrl, WithIconUrl, WithCatalogId, WithIsDirectory, and WithConstraints, which registers field relationships.
Field types
StringField
--domain example.okta.com
Environment variable: BATON_DOMAIN=example.okta.com
BoolField
--ldaps or --ldaps=true
Environment variable: BATON_LDAPS=true
IntField
--port 636
Environment variable: BATON_PORT=636
StringSliceField
--skip-groups "Group1" --skip-groups "Group2"
Environment variable: BATON_SKIP_GROUPS="Group1,Group2"
StringMapField
A map of string keys to values:SelectField and MultiSelectField
SelectField limits a field to one value from a list. MultiSelectField allows several:
--auth-type oauth
Other field types
For specialized inputs, thefield package also has MultilineField, FileUploadField, RandomField, and Oauth2Field.
Field options
Required fields
Secret fields
Default values
WithDefaultValueFunc computes a default when the connector starts, and WithSuggestedValue suggests a value in the C1 configuration interface without setting a default.
Hidden fields
Shorthand flags
Display and metadata options
Who sets a field
WithExportTarget controls who is expected to set a field:
Fields you add to a connector appear in the C1 configuration interface unless you set a different target. Use
ExportTargetCLIOnly for settings that tenant admins shouldn’t see. WithRequiredInGUI makes a field required in the interface without making it required on the command line.
Validation rules
String validation
Eq, Len, NotContains, and format checks such as IsEmail, IsHostname, IsIP, IsURI, and IsUUID.
Integer validation
Other validation
WithStringSlice, WithStringMap, and WithBool accept rules for those field types. WithStringSlice supports item-count limits, uniqueness, and rules for each item.
Field relationships
Relationships constrain which fields can be set together. Register them withfield.WithConstraints when you build the configuration: