Description
`run` replaces _tokens_ in a config file tempalte by values from the specific data sources, saves a new config file and executes a command.
It was designed to be used in _docker containers_ where a config file should receive values from the data sources before running the container's command.
run alternatives and similar packages
Based on the "Command Line" category.
Alternatively, view run alternatives based on common mentions on social networks and blogs.
-
Rich Interactive Widgets for Terminal UIs
Rich interactive widgets for terminal-based UIs written in Go -
The Platinum Searcher
A code search tool similar to ack and the_silver_searcher(ag). It supports multi platforms and multi encodings. -
tcell
Tcell is an alternate terminal package, similar in some ways to termbox, but better in others. -
readline
A pure golang implementation that provide most of features in GNU-Readline under MIT license. -
asciigraph
Go package to make lightweight ASCII line graph ╭┈╯ in command line apps with no other dependencies. -
CLI Color
Terminal color rendering tool library, support 8/16 colors, 256 colors, RGB color rendering output, compatible with Windows. -
mow.cli
A Go library for building CLI applications with sophisticated flag and argument parsing and validation. -
termtables
A Go port of the Ruby library terminal-tables for simple ASCII table generation as well as providing markdown and HTML output -
tabular
Print ASCII tables from command line utilities without the need to pass large sets of data to the API.
Get performance insights in less than 4 minutes
Do you think we are missing an alternative of run or a related project?
Popular Comparisons
README
run
run
replaces tokens in a config file tempalte by values from the specific data sources, saves a new config file and executes a command.
It was designed to be used in docker containers where a config file should receive values from the data sources before running the container's command.
Data sources
- Environment variables
- Local JSON file
- Remote JSON file
- AWS SecretManager
Options
--input value, -i value The config template with the tokens to be replaced [$RUN_INPUT]
--output value, -o value The output path for the compiled config file [$RUN_OUTPUT]
--delay value, -d value Number of seconds to wait before running the command (default: 0) [$RUN_DELAY]
--json value, -j value JSON data to be used by JSONLoader [$RUN_JSON]
--remote-json value, -r value URL to a JSON file to be used by RemoteJSONLoader [$RUN_REMOTE_JSON]
--json-file value, -f value Path to a JSON file to be used by JSONFileLoader [$RUN_JSON_FILE]
--aws-secret value The ARN or name of a secret with a JSON encoded value [$RUN_AWS_SECRET_ARN]
--env-file value A dotenv file template to be rendered and added to the environment [$RUN_ENV_FILE]
--env-output-var value Create a environment variable with the contents of the output file [$RUN_ENV_OUTPUT_VAR]
--help, -h show help
--version, -v print the version
Example
The example below is of a container with a webserver but before starting the server it will compile the config file template using the run
command.
Environment variables (.env)
MONGO_URL="mongodb://user:[email protected]/mydb"
JWT_SECRET="my$uper$ecret"
SERVER_BIND="0.0.0.0"
SERVER_PORT="8000"
Local JSON file (/mnt/shared/secrets/vars.json)
{
"server": {
"bind": "0.0.0.0"
}
}
Remote JSON file (http://config-service/app/config.json)
{
"server": {
"port": "1234"
}
}
AWS SecretManager
Secret name: jwtconfig
{
"jwt": {
"secret": "myjwtsecret"
}
}
Config template (config.toml.dist)
[database]
url = "{{MONGO_URL}}"
[jwt]
secret = "{{jwt.secret|JWT_SECRET}}"
[server]
bind = "{{server.bind|SERVER_BIND}}"
port = "{{server.port|SERVER_PORT}}"
Dockerfile
FROM busybox:1.25.1
MAINTAINER Tarcisio Gruppi <[email protected]>
ADD https://github.com/txgruppi/run/releases/download/0.0.1/run_linux_amd64 /app/run
ADD ./config.toml.dist /app/config.toml.dist
ADD ./server /app/server
RUN run \
-d 2 \
--json-file /mnt/shared/secrets/vars.json \
--remote-json http://config-service/app/config.json \
--aws-secret jwtconfig \
-i /app/config.toml.dist \
-o /app/config.toml \
/app/server -c /app/config.toml
Running the container
docker run -d --restart=always --env-file .env -p 1234 txgruppi/run-sample
Compiled config file (config.toml)
[database]
url = "mongodb://user:[email protected]/mydb"
[jwt]
secret = "myjwtsecret"
[server]
bind = "0.0.0.0"
port = "1234"