env2cfg

command module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 13 Imported by: 0

README

env2cfg

env2cfg substitutes variables in specified template with variables found in a dotenv file or environment.

Installation

go install github.com:bldrdash/env2cfg@latest

Usage

cba@snow:~/work/env2cfg$ ./env2cfg -H
env2cfg reads environment variables and produces a config file based on a template

Usage: 
  env2cfg [FLAGS] <template> [<dotenv>] [<output>]
  env2cfg -G <template> [<dotenv>]
  env2cfg -H

Details:
env2cfg will read environment variables from the system and/or the <dotenv> file and 
output to <output>.  If <dotenv> is omitted, nly the system environment will be used 
for variables. <output> is optional and will default to stdout if not provided.

When envoked with the -G flag, env2cfg will generate the <dotenv> file based on 
variables found in <template> If <dotenv> is omitted, the output will be written to stdout.

<template> can be in any format and will be parsed for variables using --delim-start 
and --delim-end.  The default delimiters are "${" and "}".

Example Template:
  mqtt:
    broker: tcp://${MQTT_BROKER}:${MQTT_PORT}
    username: ${MQTT_USER}
    password: ${MQTT_PASS}

Flags:
  -D, --dry-run              Don't write to output-file.
  -G, --gen                  Generate <dotenv> based on <template>.
  -E, --override             Favor envfile over environment.
  -e, --vars key=value;...   Add variables from command line.
  -p, --perms string         Set <output> permissions. (default "0640")
  -I, --ignore-perm          Don't check <envfile> file permissions.
  -q, --quiet                Don't display warnings.
  -v, --version              Show version.
  -H, --detailed             Show detailed help and example.
      --delim-start string   Starting delimiter string. (default "${")
      --delim-end string     Ending delimiter string. (default "}")

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL