Refactor entrypoint, parse config from env vars and file #1131
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR does two things:
It refactors the Conduit entrypoint and extracts it into
pkg/conduit
. We now provide a single functionServe
that parses the config and runs Conduit (default behavior of the Conduit CLI). It takes aConfig
and uses the values from it as default values. If values are provided via flags, env variables or a config file, the default config values are overwritten. This allows us to easily create different Conduit distributions that are configured with different default values or contain different built-in plugins and processors, e.g.:We now use peterbourgon/ff to parse the CLI flags. This additionally allows us to parse the config from environment variables (lower priority) or a configuration file (lowest priority).
CONDUIT
and contain underscores instead of dots and hyphens (e.g.CONDUIT_DB_TYPE=postgres
andCONDUIT_DB_POSTGRES_CONNECTION_STRING=postgres://localhost:5432/conduitdb
).conduit.yaml
and can be adjusted using the flag-config
. The expected format is YAML and keys with dots can be hierarchically split, e.g.:Fixes #31
Quick checks: