个人秘钥管理
dotenvx命令行主要是针对项目的.env
文件进行加密和解密操作,但是实际的使用过程中,还会涉及到个人的一些秘钥管理,
如网站的登录账号、银行账号登,这个时候就需要一个个人的秘钥管理工具,这个也就是mkey命令行工具的作用。
mkey命令行,也就是master-key(万能钥匙)的缩写,主要是用来管理个人的秘钥和账号信息,帮助信息如下:
mkey: Effortlessly manage your credentials, just like using a master key
Usage: mkey [OPTIONS] [COMMAND]
Commands:
set Set a single credential
get Return a single credential
encrypt convert .env file(s) to encrypted .env file(s)
decrypt convert encrypted .env file(s) to plain .env file(s)
ls print all global .env files
help Print this message or the help of the given subcommand(s)
Options:
-p, --profile <profile> Profile to use, such as 'default'(default), 'github', 'ai', 'self' etc.
-c, --command <command>... Run the command with injected credentials from .env file
--no-color Disable colored output, and you can use NO_COLOR env variable too.
-h, --help Print help
-V, --version Print version
mkey会将个人相关的私密信息存储在$HOME/.dotenvx
目录下,会根据不同的profile(场景)保存为不同的文件,如下:
$HOME/.dotenvx/.env.g_default
: 用于保存个人未分类的信息$HOME/.dotenvx/.env.g_company
: 用于保存公司相关的账号信息$HOME/.dotenvx/.env.g_social
: 用于保存社交账号信息$HOME/.dotenvx/.env.g_bank
: 用于保存银行账号信息
当然你也可以根据自己的需要,创建其他的profile,如$HOME/.dotenvx/.env.g_ai
用于保存AI相关的账号信息。