envers
0.4.1
Envers是一种命令行工具(CLI),旨在管理和版本的环境变量,用于不同部署阶段,例如分期,开发和生产。它提供了一种安全且有条理的方法来处理特定环境配置。
TBD
以下是envers的最初子命令:
envers init :初始化envers环境。envers deploy <spec version number> :从规格文件中部署特定版本。envers draft <spec version number> :在规格文件中创建新版本草稿。此命令的一些变体:envers draft <spec version number> --from <previous spec version number>envers draft <spec version number> --from-env .envenvers profile-set --profile <profile_name> --spec <version_number> :添加新内容。envers profile load --profile prod --spec <spec version> :将特定的环境配置文件加载到文件envers init在.envers/.specs.yaml上创建规格文件。
envers deploy创建文件.envers/.data.lock 。该文件由envers命令自动生成,并加密。
./.envers/.specs.yaml的初始版本看起来像这样:
version : 0.1 # the envers spec version
releases :如您所见,它没有太多信息。如果要起草新版本,则可以运行以下命令:
$ envers draft 1.0在此命令之后, .envers/specs.yaml文件应该看起来像:
version : 0.1 # the spec version
releases :
# placeholder: the version for the environment variables.
# if the status is draft, feel free to change the version number
1.0 :
# status attribute is handled by command line, don't change it manually
status : draft # options are: draft, cancelled, deployed
# placeholder: update help with the real help text
help :
# placeholder: a list of available profiles (groups) for this version.
# at least one profile is required for the deploying
profiles :
- base
# define the spec for that version, this spec should be used for all
# profiles (groups) inside this version
spec :
# define the env file or any other kind of environment file to be used,
# for now it just has support for .env files
files :
# placeholder: change `.env` to the correct dotenv file relative path
.env :
type : dotenv # default
# `vars` is a dictionary for the environment variables
# this defines the variables and some metadata, but not the real
# value, because it is just the definition of the spec.
vars :
# placeholder: ENV is just a variable name, replace it by your real
# environment variable
ENV :
type : string # options are: string, int, bool, path
default : dev # in the case that the variable is not defined现在,您可以部署第一个版本的环境变量:
$ envers deploy 1.0部署版本时,它将自动创建所有新规格,以中的.envers/data.lock 。
每个配置文件和规格版本的所有变量都存储到.envers/data.lock中,并且由于任何原因都不应更改此文件。
最后,我们可以为base配置文件创建环境变量:
$ envers profile set --profile base --spec 1.0 envers将通过提示询问您的值1.0版规格中定义的每个变量。
https://osl-incubator.github.io/envers
BSD-CLAUSE 3