@atlasauth/cli (英语)
atlas - 管理端口的阿特拉斯实例,在密钥上
后端API. 同行 auth0-cli 和办事员 cli,直接基于
@atlasauth/backend。 。 。 .
安装
npm i -g @atlasauth/cli
# or run without installing:
npx @atlasauth/cli --help
认证
CLI 是配置文件 + 基于密钥, 如 auth0-cli符号模型 - 不
仪表盘 OAuth app 用于注册.
atlas login # prompts for an API URL + an sk_ key, validates it
atlas login --profile prod # store a second, named credential
atlas whoami # show the active profile + instance (key masked)
atlas logout # forget a stored credential
login 用一个便宜的后端调用验证密钥,然后保存到
~/.config/atlasauth/config.json (模式) 0600) (中文(简体) ). --url 编号 : --secret-key 跳过
给CI的提示.
信封覆盖( 胜过存储的配置文件, 如大多数 云 CLIs) :
ATLAS_SECRET_KEY=sk_live_... ATLAS_API_URL=https://api.atlasauth.net atlas users list
图标
atlas users list | get <id> | create --email <e> | delete <id>
atlas orgs list | get <id> | members <id>
atlas api-keys list | create --subject-type <t> --subject-id <id> | revoke <id>
atlas webhooks list | create --url <url> [--events a,b]
atlas sessions revoke <id>
atlas config export [--dir <path>] [--format json|yaml]
atlas config import [--dir <path>] [--format json|yaml] [--dry-run] [--prune] [--force-hook]
atlas plan [<file|dir>] [--check] [--json] [--secrets-file <dotenv>]
atlas apply [<file|dir>] [--yes] [--check] [--prune] [--secrets-file <dotenv>] [--out <dir>]
atlas init --product <name> [--domain <d>] [--instance-env development|production] [--with-dev] [--no-env-files --json] ...
atlas init --next [--mount /atlas] [--dir <app-root>]
atlas init nextjs-local-users [--dir <app-root>]
atlas setup-guide [--json]
atlas preflight [--instance <id> | --product <name>] [--fail-on error|warning] [--fix [--yes]]
atlas doctor [--origin <url>] [--only <sources>] [--no-probe]
atlas doctor --scan-dir <path> [--scan-image <ref>]
atlas golive --origin <url> [--dry-run] [--yes] [--connect cookiemunch,forumulate,chatly,referalli] [--keys-file <f>] [--config <file>] [--revoke-unused-platform-keys]
atlas keys rotate <id> [--preset app-runtime] [--overlap 72h] [--out <file>] # new secret goes to a 0600 file, the old key works for the overlap
atlas keys create (--scopes "<scopes>" | --preset app-runtime) [--name n]
atlas dev proxy --app <url> --api <fapi url> [--base-path /atlas]
atlas referrals connect ... [--dry-run]
atlas env --product <name> --format dotenv|coolify|vercel
atlas client rotate <client-id> [--now | --overlap <seconds>]
atlas import <users.jsonl> [--dry-run] [--since <ts>] [--on-conflict skip|update] [--password-policy active|until_email_verified]
atlas import --from <vendor> <export-file> [--dry-run] [--since <ts>] [--on-conflict skip|update] [--password-policy ...]
atlas users clear-password <user-id>
atlas migrate code --from <clerk|authjs|supabase|auth0|better-auth> [path] [--yes]
atlas info [path]
atlas actions list | deploy <file> | test <file> | gallery [query] | show <slug>
| install <slug> [--secrets-file f] | installs | update <id> | publish <template.json>
每个命令都用 --json 用于生JSON(否则为人表. 标注
清单users list, (中文(简体) ), orgs list采取 --limit <n> 财务报告和审定财务报表 --starting-after <cursor>;表格页脚打印出下一页的光标.
atlas users list --limit 20
atlas users list --json | jq '.data[].id'
atlas api-keys create --subject-type user --subject-id user_123 --name ci
运行 atlas --help 或者说 atlas <command> --help 详细情况, atlas --version
对于版本.
机密会转到文件
任何收到密钥的命令( 一个实例密钥, OAuth 客户端)
写给一个用户 0600
dotenv 文件在下面 ~/.config/<product>/ (目录) 0700· ;
~/.config/atlasauth/ 无 --product),并只打印路径. 一个
已存在的不同文件从未被覆盖 --force。 。 。 .
--print-secret 以示警告.
atlas init 将每个环境保存在自己的文件夹中(production/atlas.env, (中文(简体) ),
development/atlas.env),这样 atlas doctor --scan-dir 保持干净 无论你先设置.
现有 <env>.env 别动. atlas init --with-dev 还创造了发展兄弟. atlas init --no-env-files --json 没有写秘密文件和手
每一个秘密 一次在JSON 在stdout.
atlas plan, (中文(简体) ), apply, (中文(简体) ), preflight 财务报告和审定财务报表 golive 永远不要在文字中打印一个秘密或 --json,以及
API错误也被掩盖了. 更改后的秘密显示为 client_secret: <redacted> (changed)。 。 。 .
阿特拉斯从不归还一个存储的秘密 所以当它无法判断你的计划是否改变时
而不是显示漂移 --rotate-secret 又发来了. --show-secrets 打印值
仅在终端中:当stdout不是TTY或 CI 已经设定.
设置一个应用( S)atlas init(中文(简体) )
export ATLAS_PLATFORM_KEY=psk_... # or: atlas login --secret-key psk_...
atlas init --product acme --domain acme.com \
--email-provider resend --email-key-file ~/.secrets/resend.key \
--strategies password,email_code,passkey \
--client-redirect https://app.acme.com/auth/callback \
--webhook-url https://app.acme.com/hooks/atlas --yes
查找或创建 app + 实例、 设置策略、 电子邮件发送器
(单位:千美元)--email managed|development|none,总是由自己的提供者进行
密钥来自 --email-key-file时,或 -中,从未使用 argv;管理
打印 DNS 记录、 自定义
域( 选项)auth.<domain>,打印 CNAME 、 第一党 OAuth 客户端和
webhook 端点 。 重跑只能填补空白. 秘密进入
~/.config/acme/production*.env; 公共价值和文件路径
~/.config/acme/atlas.json。 。 。 .
atlas preflight --product acme --fail-on warning # CI gate: exit 1 on findings
atlas env --product acme --format dotenv # public values + *_FILE paths
atlas client rotate oc_123 --product acme --overlap 3600
atlas setup-guide 将设置调用顺序与每个调取的读取顺序一起打印,以及
atlas init --next --mount /atlas 写入 atlas.yaml中,下个js挂载并验证路线和a
.env.example 表示哪些变量是构建参数(仅可公布的密钥). atlas doctor --scan-dir . 财务报告和审定财务报表 --scan-image <ref> 在构建元数据、打印文件和行以及
从不值. atlas preflight --fix 应用服务器标记安全,先询问.
活下来吧atlas golive(中文(简体) )
atlas golive --origin https://app.acme.com --dry-run # validate every write, change nothing
atlas golive --origin https://app.acme.com
按顺序运行这些步骤,并在第一次失败时停止,其固定:
- 域: 验证源主机尚未验证的自定义域. 如果可以移动发行商,它会打印出发行商和
previousIssuers值将添加到您的验证符中,并停止,除非--yes。 。 。 . - 发行者: 该域的发现文件( 或您的应用程序上挂载的路径) 必须为实例的发行者服务 .
- 与 atlas 一起签名( in): 当实例宣布时打开.
- 网络用户:每个不活跃的端点都得到测试送出,只有在成功时才能被激活.
- 钩子: 已配置但已禁用
before_user_create钩子得到一个测试调用,只有在它成功时才启用. - 飞行前 (无错误发现)和 登录准备度( r) 原产地,有一个活的JWKS来回旅行.
- 整合: 转诊连接,隐私整合和身份整合 实例宣布; 已宣布但尚未测试的转诊连接测试.
- 未瞄准的键: 一个全方位( u)
*) 仍在使用的秘密密钥与精确的atlas keys rotate <id> --preset app-runtime --overlap 72h --out <file>命令,该命令可以替换它,而无需中断时间.
--connect (四个伙伴中的任何子集)在整合步骤前将它们与
密钥从 --keys-file (默认) ~/.config/atlas/partner-keys.env; 拒绝,除非您能够读取
目标: FORUMULATE_API_KEY, (中文(简体) ), COOKIEMUNCH_API_KEY, (中文(简体) ), REFERALLI_API_KEY,以及 <PARTNER>_AUDIENCE (单位:千美元)
首先连接。 它打印每个集成的表格:事件接收器,铸币符,赎回主机.
每一步印数 ✓ step — detail 或者说 ✗ step — problem 接下来是 fix: …时退出 0
所有通过,第一次失败1. --dry-run 发送每封信 ?dry_run=true这样
没有什么变化. --json 指纹 { ok, dry_run, origin, steps: [{ id, ok, detail, fix? }] }。 。 。 .
atlas doctor --origin <url> 在综合保健报告中增加只读检查:
飞行前错误、 登录准备状态、 该主机上的路径站点验证状态以及
同意声明是否列出所读 SDKs 的每个饼干(__session, (中文(简体) ),
__atlas_uat, (中文(简体) ), __atlas_rt, (中文(简体) ), __client) (中文(简体) ).
atlas referrals connect --dry-run 列出它会打给查询平台的电话
并验证 Atlas 设置 ?dry_run=true。没有保存或打印任何秘密
没有连接测试运行.
配置码( A)atlas config(中文(简体) )
奥特0号 deploy-cli 等效: 将实例的配置绕行到 a
git 中保存的决定性目录树 . export 每个文件写一个
资源类型,有排序的密钥和 隐藏省略· ; import {\fn黑体\fs22\bord1\shad0\3ahbe\4ah00\fscx67\fscy66\2chffffff\3ch808080}我发现
与活性实例相对应的目录并应用创建/更新一元数据.
atlas config export --dir ./atlas-config # snapshot the instance
atlas config import --dir ./atlas-config --dry-run # preview the plan
atlas config import --dir ./atlas-config # apply creates/updates
atlas config import --dir ./atlas-config --prune # also delete removed resources
管理的资源类型(Terraform提供者管理的同一套):
instance (自动配置 + 允许来源), email_provider, (中文(简体) ), hooks (单位:千美元)before_user_create, (中文(简体) ), branding, (中文(简体) ), oauth_clients, (中文(简体) ), oauth_providers, (中文(简体) ),
sso_connections, (中文(简体) ), sso_onboarding_profiles, (中文(简体) ), cookie_consent, (中文(简体) ), resource_servers, (中文(简体) ), jwt_templates, (中文(简体) ), roles, (中文(简体) ),
webhook_endpoints, (中文(简体) ), billing_plans, (中文(简体) ), redirect_urls, (中文(简体) ), org_settings_schema, (中文(简体) ),
notification_templates, (中文(简体) ), email_templates, (中文(简体) ), organization_policies附加时 domains, (中文(简体) ),
integrations, (中文(简体) ), referrals, (中文(简体) ), privacy_orchestrator 财务报告和审定财务报表 proxy_secret (下关.
使其安全和可重复的规则:
- 决取相取. 键被排序,所以再导出一个不变的实例是
字节取字节取去去去去去去去去去去来去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去
export接下来import)是一个空的diff. - 磁盘上没有秘密. 管理API从不给读数回一个秘密,
故无一文. 在导入时( 重写) 写入证书, 插入
${ENV_VAR}文件中的占位符; 它从环境中解决. - 无损相.
import从不删除--prune资源 没有文件的类型不受影响(只管理承诺类型).
一个文件 : atlas apply 财务报告和审定财务报表 atlas plan
atlas apply atlas.yaml 取一个 JSON 或 YAML 文件,其顶级密钥为
以上资源类型(或来自 config export显示计划,
申请前的询问(--yes 跳过问题;不需要终端),
并适用。 重新运行它是一个无操作. atlas plan atlas.yaml 显示
字段级别 diff 不写; 不写 --prune 它只比较键
文件集. --force-hook 应用 a before_user_create 更改(使之可行,或
重点/ 重键已启用的已关闭的钩子), 测试呼叫失败( 否则服务器以 409 拒绝) HOOK_TEST_FAILED) (中文(简体) ).
# atlas.yaml
instance:
allowed_origins: [https://app.example.com]
auth_config:
signUpMode: restricted
redirect_urls:
- url: https://app.example.com/auth/callback
webhook_endpoints:
- url: https://app.example.com/webhooks/atlas
enabled_events: [user.created, user.updated, session.revoked]
atlas plan atlas.yaml --check # CI: exit 2 when the instance differs
atlas apply atlas.yaml # plan, confirm, apply
atlas apply atlas.yaml --yes --secrets-file .atlas.secrets # non-interactive
- CI门.
--check联 合 国plan, (中文(简体) ),apply财务报告和审定财务报表config plan; 别名--exit-code(中文(简体) ) 当有漂移且不写时, 退出 2 . - 秘诀.
${VAR}占位符来自环境,然后从--secrets-file(一多腾v文件). 文件只能由您读取 (单位:千美元)chmod 600)),任何松散被拒绝.apply如果写到 占位符仍未解决. - 新的秘密。 新的秘密. 何时
apply创建 OAuth 客户端或 Webhook 端点, 一次性client_secret/ 签名密钥会转到模式 0600 dotenv 文件 (单位:千美元)~/.config/atlas,或--out <dir>)和CLI打印路径. - 肃静. CLI 按固定顺序应用资源类型 :
instance, (中文(简体) ),org_settings_schema, (中文(简体) ),redirect_urls, (中文(简体) ),oauth_clients, (中文(简体) ),oauth_providers, (中文(简体) ),custom_oauth_providers, (中文(简体) ),resource_servers, (中文(简体) ),scopes, (中文(简体) ),jwt_templates, (中文(简体) ),permissions, (中文(简体) ),roles, (中文(简体) ),webhook_endpoints, (中文(简体) ),sso_connections, (中文(简体) ),sso_onboarding_profiles, (中文(简体) ),billing_plans, (中文(简体) ),notification_templates, (中文(简体) ),email_templates, (中文(简体) ),organization_policies, (中文(简体) ),cookie_consent编辑 命令是由CLI而不是由服务器完成的。 电子邮件提供者 (单位:千美元)email_provider,任何运输:resend、Brevo、SES、SMTP、Mailgun、SMTP2GO或webhook)和before_user_create钩子是配置文件部分; 电子邮件 提供者先应用,所以发送电子邮件的登录方法会找到提供者.
域名,集成,转介,隐私,代理秘密.
domains:
- host: app.example.com # a path mount on your own host
method: path
base_path: /atlas
integrations:
- id: forumulate
enabled: true
audience: forumulate:acme
events_url: https://app.example.com/hooks/forumulate
org_id: acme-org-id # forumulate: the organization
spaces: [space-1, { id: space-2, redeem_url: https://app.example.com/redeem }] # bare ids are expanded like stored spaces and keep their redeem URLs; plan compares by id
forumulate_api_key: ${FORUMULATE_API_KEY} # used for the call only, never stored
replace_existing: false # forumulate: remove the org's other reader sign-ins (needs the key)
- id: chatly
channel: support # same as audience: chatly:support
chatly_api_key: ${CHATLY_API_KEY} # used for the call only, never stored
claims: { org: true, org_role: true, public_metadata: [plan] }
ttl_seconds: 120
backchannel_logout_url: https://app.example.com/logout
oauth_client_id: my-sign-in-client
# Also accepted: principal_claim, ext_claim, verify_error_report_url, cmp, atlas_id_users,
# per_call_audience, external_ref, and for a custom id: name, role, audience_format.
# `integrations:` may also be a map keyed by id instead of a list.
referrals:
provider: referalli
enabled: true
api_key: ${REFERALLI_API_KEY}
privacy_orchestrator:
provider: cookiemunch
site_id: ${COOKIEMUNCH_SITE}
api_key: ${COOKIEMUNCH_API_KEY}
proxy_secret:
set: true # created once; the value goes to a 0600 file
每个都有计划,还有 plan --check 当有人在仪表板上更改时,出口2(用于:
例如,关闭集成)。 一个域只主张, 从未删除, 除非你通过
--prune; 拒绝更改域名( 重建) . webhook_endpoints 还带 secret: ${ENV}
(阿特拉斯用你的秘密,没有写在多滕夫档案上), active: false, (中文(简体) ),
signature_versions 财务报告和审定财务报表 external_ref (只创建),和 enabled_events: ["preset:user_mirror"]
以书面存储(一行将扩展的列表计划按等值存储). atlas golive 激活一个已暂停的终点
成功交付测试.
用推车来运送 atlas-deploy GitHub 动作。 。 。 .