Store a per-profile API URL for multi-environment auth
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 冷清
- 技术栈
- rust
- 领域
- api, authentication, cli
调研方向
Start with the TokenStore schema and migration paths, then trace read_token, Authentication::new, fetch_profile_info, and fetch_profiles_with_info. Resolve the open URL-capture decision before implementing. Done means profile URLs round-trip, legacy profiles fall back to the global default, and auth list uses each profile's host in tests.
由索引模型根据 Issue 内容生成。
描述
Background
The multi-profile auth work in #293 stores only a token per profile, and every command resolves the API host from the single API_BASE_URL (defaulting to prod). Since multi-profile usually means multi-environment (for example a prod profile and a stage profile), this means:
auth listsends every stored token to the one host, so a stage token gets transmitted to the prod host and then shows blank because it 401s.- There is no way to keep a profile pinned to the environment its token belongs to.
Raised by @sergey-borovkov in review: it is much cheaper to decide the storage format now, while it is new, than to migrate it a second time later.
Proposal
Store an optional API URL per profile and use it wherever a profile's token is used (read_token/Authentication::new, fetch_profile_info, fetch_profiles_with_info). Profiles without a URL (including migrated legacy ones) fall back to the current global default, so this stays backward compatible.
Open decision — how is the URL captured?
This is the reason it was deferred from #293 rather than guessed at. Options:
screenly login --url <url>— explicit, but one more flag to pass.- Capture the resolved
API_BASE_URL(env or default) at login time and store it — zero new flags, but implicit and easy to get wrong if the env var isn't set. - Both:
--urloverrides, otherwise capture the resolved base URL.
Option 3 is probably the most forgiving. Worth agreeing on before implementing.
Scope / touch points
TokenStoreschema: each entry becomes token + optional url (migration-safe, since serdeOptiondefaults toNone).- Migration: legacy plain-text and existing single-token stores get
url: None→ global default. read_token/Authentication::new: resolve the active profile's url alongside its token.fetch_profile_info/fetch_profiles_with_info: use the per-profile url.- Tests: per-profile url round-trips, fallback to default when absent,
auth listhits each profile's own host.
Notes
- Not a blocker for #293; that PR intentionally leaves this out.
- Backward compatible if the url field is optional with a default.
- 主要语言
- Rust
- 星标
- 29
- 派生
- 7
- 平均合并
- 3 天 16 小时
- 30 天内合并 PR
- 5
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Screenly/cli 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 48/100
-
Improve error messages when not logged in可能重新可做 @sergey-borovkov 于 304 天前认领,目前没有进行中的 PR。 未关闭
-
难度 3/5 1-2 天 新手友好度 42/100
-
bug
难度 2/5 1-3 小时 新手友好度 55/100
-
enhancement
难度 3/5 1-2 天 新手友好度 45/100
相似的 Issue
-
arch-audit refactor
难度 2/5 1-3 小时 新手友好度 82/100
SocketDev/socket-patch#1011 ·
维护者通常 1 天内回复
-
L: github:actions L: php:composer
难度 2/5 1-3 小时 新手友好度 88/100
dependabot/dependabot-core#16493 ·
维护者通常 1 天内回复
-
agent-ready area:breg bug criticality:p3 triage:needs-implementation
难度 2/5 1-3 小时 新手友好度 78/100
registrystack/registry-stack#1941 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
joshstevens19/rindexer#483 ·
维护者通常 1 天内回复
-
VX_PRINT_DROPS prints each drop point twice on the default code generator, the second time at line 0未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复