feat(cmd/influxd): add print-config
subcommand to support automation
#20524
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.
Closes #20517
This command is meant to support our Docker entry-point in two ways.
First, in our documentation for how to customize the
influxd
config we can advise runninginfluxd print-config
to generate a starting template file. This mirrors the existing docs for our 1.x image.Second, we want the container entry-point to support running setup scripts mounted by the user, but only if the DB hasn't already been set up. To do this in a robust way while also supporting custom config / env vars / CLI args, we need to be able to determine the final values of configs like the bolt path & HTTP bind address. We can use
influxd print-config
with the--key-name
option to do this.If the user runs something like:
Then within our entrypoint script we can run: