Giter Site home page Giter Site logo

env2cfg's Introduction

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 "}")

env2cfg's People

Contributors

bldrdash avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.