2 个版本
0.0.6 | 2024年2月16日 |
---|---|
0.0.0 | 2023年5月10日 |
在 身份验证 中排名 #237
11KB
170 行
opx
此工具允许您使用 opx
二进制文件启动应用程序,并将所有 .env
文件传递给 op run ...
。
安装
cargo安装 opx
# start your app with secrets injected
opx
上面的命令将在后台运行
op run --env-file=.env --env-file=apps/web/.env -- npm start
演示
在演示仓库中展示其正确操作的示例
opx ✔ $ opx
[OPX] Forcing terminal colors with FORCE_COLOR=1
[ENV] .env
[ENV] apps/demo/.env
[ENV] apps/other-app/.env
[OPX] op run --env-file=/Users/hacksore/Code/opensource/demo-1pass-secrets/.env --env-file=/Users/hacksore/Code/opensource/demo-1pass-secrets/apps/demo/.env --env-file=/Users/hacksore/Code/opensource/demo-1pass-secrets/apps/other-app/.env -- npm start
> demo-1pass-secrets@0.0.0 start
> turbo run start
• Packages in scope: demo, eslint-config-custom, other-app, tsconfig
• Running start in 4 packages
• Remote caching disabled
demo:start: cache bypass, force executing 545833253ebd38cc
other-app:start: cache bypass, force executing 2ed51133d14970ce
other-app:start:
other-app:start: > other-app@1.0.0 start
other-app:start: > node main.js
other-app:start:
demo:start:
demo:start: > demo@1.0.0 start
demo:start: > node main.js
demo:start:
demo:start: Hello this is a sample app that uses a secret from 1password cli
other-app:start: Hello this is a sample app that uses a secret from 1password cli
demo:start: Secret is: <concealed by 1Password>
other-app:start: Secret is: <concealed by 1Password>
Tasks: 2 successful, 2 total
Cached: 0 cached, 2 total
Time: 216ms
调试
如何链接它
# dev
cargo watch -x "build --release"
# link it
export PATH="$HOME/code/opensource/opx/target/release:$PATH"
考虑因素
- 如何处理重复的 env 变量?
- 如何处理不同的环境维度(.env.local 与 .env.production 等)
依赖项
~2–10MB
~99K SLoC