Git Product home page Git Product logo

env2file's Introduction

简介

由环境变量生成配置文件的命令行工具,常用于集成的Docker容器中,容器启动后、服务真正进程启动前执行。

使用说明

NAME:
   env2file - A new cli application

USAGE:
   env2file [global options] command [command options] [arguments...]

COMMANDS:
     conversion, conv  Renders the specified file template by reading the environment variable
     create, cre       Generates a configuration file to the specified path by reading the environment variable and following the specified format
     help, h           Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

生成指定格式的配置文件

env2file create 命令根据指定规范生成配置文件,现支持 mysql redis and default

关于生成mysql配置文件

读取以MYSQLC_开头的环境变量,以下划线分割,第二部分为配置块名称,比如mysqld 或者client. 第三部分为配置名 例如: MYSQLC_MYSQLD_PORT = 3306 custom.cnf:

[mysqld]
 port = 3306

关于生成redis配置文件

读取以REDISC_开头的环境变量,以下划线分割,第二部分为配置名 例如: REDISC_PORT = 6379 custom.conf:

port 6379

关于生成默认配置文件

读取以C_开头的环境变量,以下划线分割,第二部分为配置名 例如: C_MYNAME = barnett custom.conf:

myname=barnett

以上类型均支持值热渲染,即如果在环境变量值中具有 ${XXX} 的规范字符串,将继续渲染值,使用对应的环境变量,仅支持一级渲染。

模版配置文件重写

env2file conversion 命令根据指定的配置文件模版,需要渲染的变量使用 ${XXX} 的形式定义。工具将根据从环境变量中获取值来渲染并重写文件,仅支持一级渲染。

env2file's People

Contributors

barnettzqg avatar

Watchers

 avatar  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.