cli: -account defaults to your own account in API mode
Every API-mode callsite goes through resolvedAccount; flag defaults flip ops -> empty. Direct mode is untouched (resolveAccount reads empty as ops), and carlos route keeps its genuine registry-mode ops default.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
10 files changed,
+61
−57
appconfig_cli.go+10 −10apps.go+6 −6cli.go+17 −13deploy.go+1 −1fleets.go+12 −12instances_cli.go+7 −7logs.go+2 −2restart.go+1 −1retention.go+1 −1store.go+4 −4
diff --git a/appconfig_cli.go b/appconfig_cli.go| index 59b10801a..566d8d735 100644 |
| --- a/appconfig_cli.go |
| +++ b/appconfig_cli.go |
| @@ -215,7 +215,7 @@ func runEnvSet(args []string) { |
| for k, v := range kv { |
| set[k] = appconfig.Var{Kind: "env", Value: v} |
| } |
| - if _, err := sess.configApply(context.Background(), apiAccount(acctRaw, acctIDRaw), *app, |
| + if _, err := sess.configApply(context.Background(), resolvedAccount(sess, acctRaw, acctIDRaw), *app, |
| apiConfigApply{Environment: *environment, Set: set}); err != nil { |
| log.Fatal(err) |
| } |
| @@ -247,7 +247,7 @@ func runEnvUnset(args []string) { |
| } |
| if sess != nil { |
| printUsing(os.Stdout, sess) |
| - removed, err := sess.configApply(context.Background(), apiAccount(acctRaw, acctIDRaw), *app, |
| + removed, err := sess.configApply(context.Background(), resolvedAccount(sess, acctRaw, acctIDRaw), *app, |
| apiConfigApply{Environment: *environment, Unset: fs.Args()}) |
| if err != nil { |
| log.Fatal(err) |
| @@ -281,7 +281,7 @@ func runEnvList(args []string) { |
| } |
| if sess != nil { |
| printUsing(os.Stdout, sess) |
| - cfg, err := sess.configGet(context.Background(), apiAccount(acctRaw, acctIDRaw), *app, *environment) |
| + cfg, err := sess.configGet(context.Background(), resolvedAccount(sess, acctRaw, acctIDRaw), *app, *environment) |
| if err != nil { |
| log.Fatal(err) |
| } |
| @@ -397,7 +397,7 @@ func runEnvExecDelivery(args []string) { |
| if value != "" { |
| wire = value |
| } |
| - if _, err := sess.configApply(context.Background(), apiAccount(acctRaw, acctIDRaw), *app, |
| + if _, err := sess.configApply(context.Background(), resolvedAccount(sess, acctRaw, acctIDRaw), *app, |
| apiConfigApply{ExecDelivery: &wire}); err != nil { |
| log.Fatal(err) |
| } |
| @@ -427,7 +427,7 @@ func runEnvEnvironments(args []string) { |
| } |
| if sess != nil { |
| printUsing(os.Stdout, sess) |
| - cfg, err := sess.configGet(context.Background(), apiAccount(acctRaw, acctIDRaw), *app, "") |
| + cfg, err := sess.configGet(context.Background(), resolvedAccount(sess, acctRaw, acctIDRaw), *app, "") |
| if err != nil { |
| log.Fatal(err) |
| } |
| @@ -477,7 +477,7 @@ func runEnvSync(args []string) { |
| } |
| if sess != nil { |
| printUsing(os.Stdout, sess) |
| - if err := sess.configSync(context.Background(), apiAccount(acctRaw, acctIDRaw), *app); err != nil { |
| + if err := sess.configSync(context.Background(), resolvedAccount(sess, acctRaw, acctIDRaw), *app); err != nil { |
| log.Fatal(err) |
| } |
| } else if err := appconfig.TouchGeneration(context.Background(), openStore(), acctOf(), *app); err != nil { |
| @@ -608,7 +608,7 @@ func runSecretsSet(args []string) { |
| } |
| if sess != nil { |
| printUsing(os.Stdout, sess) |
| - pub := secretsPubKeyAPI(sess, apiAccount(acctRaw, acctIDRaw), *app) |
| + pub := secretsPubKeyAPI(sess, resolvedAccount(sess, acctRaw, acctIDRaw), *app) |
| set := make(map[string]appconfig.Var, len(kv)) |
| for k, v := range kv { |
| env, err := appconfig.Seal(pub, []byte(v)) |
| @@ -617,7 +617,7 @@ func runSecretsSet(args []string) { |
| } |
| set[k] = appconfig.Var{Kind: "secret", Envelope: env} |
| } |
| - if _, err := sess.configApply(context.Background(), apiAccount(acctRaw, acctIDRaw), *app, |
| + if _, err := sess.configApply(context.Background(), resolvedAccount(sess, acctRaw, acctIDRaw), *app, |
| apiConfigApply{Environment: *environment, Set: set}); err != nil { |
| log.Fatal(err) |
| } |
| @@ -658,7 +658,7 @@ func runSecretsUnset(args []string) { |
| } |
| if sess != nil { |
| printUsing(os.Stdout, sess) |
| - removed, err := sess.configApply(context.Background(), apiAccount(acctRaw, acctIDRaw), *app, |
| + removed, err := sess.configApply(context.Background(), resolvedAccount(sess, acctRaw, acctIDRaw), *app, |
| apiConfigApply{Environment: *environment, Unset: fs.Args()}) |
| if err != nil { |
| log.Fatal(err) |
| @@ -704,7 +704,7 @@ func runSecretsList(args []string) { |
| } |
| if sess != nil { |
| printUsing(os.Stdout, sess) |
| - cfg, err := sess.configGet(context.Background(), apiAccount(acctRaw, acctIDRaw), *app, *environment) |
| + cfg, err := sess.configGet(context.Background(), resolvedAccount(sess, acctRaw, acctIDRaw), *app, *environment) |
| if err != nil { |
| log.Fatal(err) |
| } |
diff --git a/apps.go b/apps.go| index 6686af179..740c804df 100644 |
| --- a/apps.go |
| +++ b/apps.go |
| @@ -199,7 +199,7 @@ func runAppsDelete(args []string) { |
| } |
| if mode == "signed-in" { |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| printUsing(stdout, sess) |
| res, err := sess.trashApp(context.Background(), acct, app) |
| if err != nil { |
| @@ -319,7 +319,7 @@ func runAppsRestore(args []string) { |
| } |
| if mode == "signed-in" { |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| printUsing(stdout, sess) |
| res, err := sess.restoreApp(context.Background(), acct, app) |
| if err != nil { |
| @@ -382,7 +382,7 @@ func runAppsCreate(args []string) { |
| // Not accountFlags: that helper also registers -registry for direct-mode |
| // resolution, and this verb never resolves locally — the console resolves |
| // the account against the caller's own memberships. |
| - acctRaw := fs.String("account", "ops", "account (sqid or name) to claim the app in") |
| + acctRaw := fs.String("account", "", "account (sqid or name) to claim the app in (default: your only account, or the configured/chosen one)") |
| acctIDRaw := fs.String("account-id", "", "account sqid, matched as a sqid ONLY — supersedes -account; this is the flag an ambiguity error tells you to use") |
| consoleFlag := fs.String("console", "", "console to create it through (default: the only logged-in one)") |
| fs.Parse(args) |
| @@ -415,7 +415,7 @@ func runAppsCreate(args []string) { |
| "box-side way to hand a name to an address. To claim through a console instead,\n" + |
| "unset the store env and run: carlos auth login -console <url>") |
| } |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| printUsing(stdout, sess) |
| res, err := sess.createApp(context.Background(), acct, strings.TrimSpace(*app), place2) |
| if err != nil { |
| @@ -475,7 +475,7 @@ func runAppsPlace(args []string) { |
| // Not accountFlags: that helper also registers -registry for direct-mode |
| // resolution, and this verb never resolves locally — placement is |
| // console-tracked state, API mode only, same as apps create above. |
| - acctRaw := fs.String("account", "ops", "account (sqid or name) the app belongs to") |
| + acctRaw := fs.String("account", "", "account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)") |
| acctIDRaw := fs.String("account-id", "", "account sqid, matched as a sqid ONLY — supersedes -account; this is the flag an ambiguity error tells you to use") |
| consoleFlag := fs.String("console", "", "console to place through (default: the only logged-in one)") |
| fs.Parse(args) |
| @@ -519,7 +519,7 @@ func runAppsPlace(args []string) { |
| "(CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR is set). Placement is console-tracked\n" + |
| "state: log in instead — carlos auth login -console <url>") |
| } |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| fmt.Fprintf(stdout, "using %s as %s\n", sess.console, sess.address) |
| if err := sess.place(context.Background(), acct, strings.TrimSpace(*app), target2); err != nil { |
| log.Fatalf("apps place: %v", err) |
diff --git a/cli.go b/cli.go| index 64b460d6a..4fb490bef 100644 |
| --- a/cli.go |
| +++ b/cli.go |
| @@ -1552,7 +1552,11 @@ func routeVersionCheck(ctx context.Context, store release.Store, pub ed25519.Pub |
| // string-coupled to this function's internal flag name the way |
| // fs.Lookup("account") would be. |
| func accountFlags(fs *flag.FlagSet) (raw, rawID *string, resolve func() string) { |
| - acct := fs.String("account", "ops", "account (sqid or name) the app belongs to") |
| + // Empty default, two meanings by mode: API mode resolves it to the |
| + // caller's own account (resolvedAccount, apimode.go); direct mode's |
| + // resolveAccount reads "" as ops exactly as it always has, so box and |
| + // script behavior is unchanged. |
| + acct := fs.String("account", "", "account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one; ops in direct mode)") |
| acctID := fs.String("account-id", "", "account sqid, matched as a sqid ONLY — supersedes -account; this is the flag an ambiguity error tells you to use") |
| regPath := fs.String("registry", defaultRegistry(), "registry database (resolves -account)") |
| return acct, acctID, func() string { return resolveAccount(*regPath, *acct, *acctID) } |
| @@ -1694,7 +1698,7 @@ func runShip(args []string) { |
| // branch defers the cleanup of a scratch tarball up to 256MiB). |
| // Evaluated as an argument, the refusal lands before runShipAPI's |
| // body has registered a defer at all. |
| - if err := runShipAPI(sess, apiAccount(acctRaw, acctIDRaw), fs, *app, *ver, *kind, *target, *label, noteText, capsSet, true); err != nil { |
| + if err := runShipAPI(sess, resolvedAccount(sess, acctRaw, acctIDRaw), fs, *app, *ver, *kind, *target, *label, noteText, capsSet, true); err != nil { |
| log.Fatal(err) |
| } |
| return |
| @@ -1958,7 +1962,7 @@ func runPromote(args []string) { |
| // flag silently do nothing. |
| log.Fatal("hotfix is an operator act — use the direct path (CARLOS_DEPLOYMENT_BUCKET) or the console") |
| } |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| printUsing(stdout, sess) |
| res, err := sess.promote(context.Background(), acct, *app, version, channel) |
| if err != nil { |
| @@ -2034,7 +2038,7 @@ func runChannels(args []string) { |
| log.Fatal(err) |
| } |
| if sess != nil { |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| printUsing(stdout, sess) |
| chans, err := sess.channels(context.Background(), acct, *app) |
| if err != nil { |
| @@ -2131,7 +2135,7 @@ func runVersionTarget(args []string) { |
| log.Fatal(err) |
| } |
| if sess != nil { |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| printUsing(stdout, sess) |
| if fs.NArg() == 0 { |
| vt, err := sess.versionTarget(context.Background(), acct, *app) |
| @@ -2276,7 +2280,7 @@ func runReleases(args []string) { |
| } |
| var rows []releaseRow |
| if sess != nil { |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| printUsing(stdout, sess) |
| rels, err := sess.releases(context.Background(), acct, *app) |
| if err != nil { |
| @@ -2323,7 +2327,7 @@ func runRollback(args []string) { |
| log.Fatal(err) |
| } |
| if sess != nil { |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| printUsing(stdout, sess) |
| if err := sess.rollback(context.Background(), acct, *app, fs.Arg(0)); err != nil { |
| log.Fatal(err) |
| @@ -2444,7 +2448,7 @@ func ledgerAPISession(consoleFlag string) *apiSession { |
| // sqid only, so the console's own symmetric resolution can never name-match |
| // it. |
| func ledgerAccountFlags(fs *flag.FlagSet) (raw, rawID *string) { |
| - return fs.String("account", "ops", "account (sqid or name) the app belongs to — resolved by the console"), |
| + return fs.String("account", "", "account (sqid or name) the app belongs to — resolved by the console (default: your only account, or the configured/chosen one)"), |
| fs.String("account-id", "", "account sqid, matched as a sqid ONLY — supersedes -account") |
| } |
| @@ -2481,7 +2485,7 @@ func runLedgerAppend(args []string) { |
| sess := ledgerAPISession(*consoleFlag) |
| printUsing(stdout, sess) |
| - a, err := sess.ledgerAppend(context.Background(), apiAccount(acctRaw, acctIDRaw), *app, name, json.RawMessage(raw)) |
| + a, err := sess.ledgerAppend(context.Background(), resolvedAccount(sess, acctRaw, acctIDRaw), *app, name, json.RawMessage(raw)) |
| if err != nil { |
| log.Fatal(err) |
| } |
| @@ -2507,7 +2511,7 @@ func runLedgerHead(args []string) { |
| } |
| sess := ledgerAPISession(*consoleFlag) |
| - h, err := sess.ledgerHead(context.Background(), apiAccount(acctRaw, acctIDRaw), *app, name) |
| + h, err := sess.ledgerHead(context.Background(), resolvedAccount(sess, acctRaw, acctIDRaw), *app, name) |
| if err != nil { |
| log.Fatal(err) |
| } |
| @@ -2530,7 +2534,7 @@ func runLedgerList(args []string) { |
| sess := ledgerAPISession(*consoleFlag) |
| printUsing(stdout, sess) |
| - body, err := sess.ledgerList(context.Background(), apiAccount(acctRaw, acctIDRaw), *app) |
| + body, err := sess.ledgerList(context.Background(), resolvedAccount(sess, acctRaw, acctIDRaw), *app) |
| if err != nil { |
| log.Fatal(err) |
| } |
| @@ -2587,7 +2591,7 @@ func runLedgerPublish(args []string) { |
| sess := ledgerAPISession(*consoleFlag) |
| printUsing(stdout, sess) |
| m := ledger.Manifest{Public: *public, Ledgers: names, Title: *title} |
| - got, err := sess.ledgerPublish(context.Background(), apiAccount(acctRaw, acctIDRaw), *app, m) |
| + got, err := sess.ledgerPublish(context.Background(), resolvedAccount(sess, acctRaw, acctIDRaw), *app, m) |
| if err != nil { |
| log.Fatal(err) |
| } |
| @@ -2633,7 +2637,7 @@ func runLedgerBlob(args []string) { |
| if len(data) > ledger.MaxBlob { |
| log.Fatalf("ledger blob: %s is %d bytes, exceeds the %d byte cap", path, len(data), ledger.MaxBlob) |
| } |
| - sha, err := sess.ledgerBlob(context.Background(), apiAccount(acctRaw, acctIDRaw), *app, name, data) |
| + sha, err := sess.ledgerBlob(context.Background(), resolvedAccount(sess, acctRaw, acctIDRaw), *app, name, data) |
| if err != nil { |
| log.Fatal(err) |
| } |
diff --git a/deploy.go b/deploy.go| index 9b1693322..57da7555f 100644 |
| --- a/deploy.go |
| +++ b/deploy.go |
| @@ -59,7 +59,7 @@ func runDeploy(args []string) { |
| } |
| sess := requireDeployAPISession(*consoleFlag) // API-mode only: member verb |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| printUsing(stdout, sess) // printed HERE, once: runShipAPI's own banner is suppressed below |
| ctx := context.Background() |
| recs, _, _, err := sess.instanceList(ctx, acct, *app, "", "") |
diff --git a/fleets.go b/fleets.go| index 8dffa5b06..3a8ba2b20 100644 |
| --- a/fleets.go |
| +++ b/fleets.go |
| @@ -155,7 +155,7 @@ func validBoxLabel(label string) error { |
| func runFleetsCreate(args []string) { |
| fs := flag.NewFlagSet("fleets create", flag.ExitOnError) |
| bucket := fs.String("bucket", "", "the customer's own data bucket (must already exist)") |
| - acctRaw := fs.String("account", "ops", "account (sqid or name) to own the fleet") |
| + acctRaw := fs.String("account", "", "account (sqid or name) to own the fleet (default: your only account, or the configured/chosen one)") |
| acctIDRaw := fs.String("account-id", "", "account sqid, matched as a sqid ONLY — supersedes -account") |
| consoleFlag := fs.String("console", "", "console to create it through (default: the only logged-in one)") |
| fs.Parse(args) |
| @@ -170,7 +170,7 @@ func runFleetsCreate(args []string) { |
| bucketV := strings.TrimSpace(*bucket) |
| sess := fleetsSignedInSession(*consoleFlag) |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| fmt.Fprintf(stdout, "using %s as %s\n", sess.console, sess.address) |
| f, err := sess.createFleet(context.Background(), acct, name, bucketV) |
| if err != nil { |
| @@ -182,7 +182,7 @@ func runFleetsCreate(args []string) { |
| func runFleetsAddBox(args []string) { |
| fs := flag.NewFlagSet("fleets add-box", flag.ExitOnError) |
| - acctRaw := fs.String("account", "ops", "account (sqid or name) the fleet belongs to") |
| + acctRaw := fs.String("account", "", "account (sqid or name) the fleet belongs to (default: your only account, or the configured/chosen one)") |
| acctIDRaw := fs.String("account-id", "", "account sqid, matched as a sqid ONLY — supersedes -account") |
| consoleFlag := fs.String("console", "", "console to add the box through (default: the only logged-in one)") |
| fs.Parse(args) |
| @@ -199,7 +199,7 @@ func runFleetsAddBox(args []string) { |
| } |
| sess := fleetsSignedInSession(*consoleFlag) |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| fmt.Fprintf(stdout, "using %s as %s\n", sess.console, sess.address) |
| token, err := sess.addFleetBox(context.Background(), acct, fleet, label) |
| if err != nil { |
| @@ -210,7 +210,7 @@ func runFleetsAddBox(args []string) { |
| func runFleetsRotateToken(args []string) { |
| fs := flag.NewFlagSet("fleets rotate-token", flag.ExitOnError) |
| - acctRaw := fs.String("account", "ops", "account (sqid or name) the fleet belongs to") |
| + acctRaw := fs.String("account", "", "account (sqid or name) the fleet belongs to (default: your only account, or the configured/chosen one)") |
| acctIDRaw := fs.String("account-id", "", "account sqid, matched as a sqid ONLY — supersedes -account") |
| consoleFlag := fs.String("console", "", "console to rotate through (default: the only logged-in one)") |
| fs.Parse(args) |
| @@ -227,7 +227,7 @@ func runFleetsRotateToken(args []string) { |
| } |
| sess := fleetsSignedInSession(*consoleFlag) |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| fmt.Fprintf(stdout, "using %s as %s\n", sess.console, sess.address) |
| token, err := sess.rotateFleetBoxToken(context.Background(), acct, fleet, label) |
| if err != nil { |
| @@ -273,7 +273,7 @@ func printFleetToken(fleet, label, token string, rotated bool) { |
| // "named, empty", not the value in *tags. |
| func runFleetsTagBox(args []string) { |
| fs := flag.NewFlagSet("fleets tag-box", flag.ExitOnError) |
| - acctRaw := fs.String("account", "ops", "account (sqid or name) the fleet belongs to") |
| + acctRaw := fs.String("account", "", "account (sqid or name) the fleet belongs to (default: your only account, or the configured/chosen one)") |
| acctIDRaw := fs.String("account-id", "", "account sqid, matched as a sqid ONLY — supersedes -account") |
| consoleFlag := fs.String("console", "", "console to tag through (default: the only logged-in one)") |
| tags := fs.String("tags", "", `comma-separated tags, full replace ("" clears every tag) — required`) |
| @@ -305,7 +305,7 @@ func runFleetsTagBox(args []string) { |
| } |
| sess := fleetsSignedInSession(*consoleFlag) |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| fmt.Fprintf(stdout, "using %s as %s\n", sess.console, sess.address) |
| if err := sess.tagFleetBox(context.Background(), acct, fleet, label, tagsV); err != nil { |
| log.Fatalf("fleets tag-box: %v", err) |
| @@ -319,7 +319,7 @@ func runFleetsTagBox(args []string) { |
| func runFleetsDetachBox(args []string) { |
| fs := flag.NewFlagSet("fleets detach-box", flag.ExitOnError) |
| - acctRaw := fs.String("account", "ops", "account (sqid or name) the fleet belongs to") |
| + acctRaw := fs.String("account", "", "account (sqid or name) the fleet belongs to (default: your only account, or the configured/chosen one)") |
| acctIDRaw := fs.String("account-id", "", "account sqid, matched as a sqid ONLY — supersedes -account") |
| consoleFlag := fs.String("console", "", "console to detach through (default: the only logged-in one)") |
| fs.Parse(args) |
| @@ -336,7 +336,7 @@ func runFleetsDetachBox(args []string) { |
| } |
| sess := fleetsSignedInSession(*consoleFlag) |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| fmt.Fprintf(stdout, "using %s as %s\n", sess.console, sess.address) |
| if err := sess.detachFleetBox(context.Background(), acct, fleet, label); err != nil { |
| log.Fatalf("fleets detach-box: %v", err) |
| @@ -346,13 +346,13 @@ func runFleetsDetachBox(args []string) { |
| func runFleetsList(args []string) { |
| fs := flag.NewFlagSet("fleets ls", flag.ExitOnError) |
| - acctRaw := fs.String("account", "ops", "account (sqid or name) to list fleets for") |
| + acctRaw := fs.String("account", "", "account (sqid or name) to list fleets for (default: your only account, or the configured/chosen one)") |
| acctIDRaw := fs.String("account-id", "", "account sqid, matched as a sqid ONLY — supersedes -account") |
| consoleFlag := fs.String("console", "", "console to list through (default: the only logged-in one)") |
| fs.Parse(args) |
| sess := fleetsSignedInSession(*consoleFlag) |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| fmt.Fprintf(stdout, "using %s as %s\n", sess.console, sess.address) |
| fleets, err := sess.listFleets(context.Background(), acct) |
| if err != nil { |
diff --git a/instances_cli.go b/instances_cli.go| index 04b37bca0..bcc5e93e4 100644 |
| --- a/instances_cli.go |
| +++ b/instances_cli.go |
| @@ -118,7 +118,7 @@ func runInstancesEnable(args []string) { |
| } |
| seedReq = &argv |
| } |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| printUsing(stdout, sess) |
| m, err := sess.instancesEnable(context.Background(), acct, *app, channelReq, seedReq) |
| if err != nil { |
| @@ -241,7 +241,7 @@ func runInstancesCreate(args []string) { |
| region := fs.String("region", "", "region code for the record (subject to the manifest's allow-list)") |
| channel := fs.String("channel", "", "release channel the instance follows (default: the manifest's, then stable)") |
| consoleFlag := fs.String("console", "", "console to create through (default: the only logged-in one)") |
| - acctRaw := fs.String("account", "ops", "account (sqid or name) the app belongs to") |
| + acctRaw := fs.String("account", "", "account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)") |
| acctIDRaw := fs.String("account-id", "", "account sqid, matched as a sqid ONLY — supersedes -account") |
| fs.Parse(args) |
| if *app == "" || *host == "" { |
| @@ -249,7 +249,7 @@ func runInstancesCreate(args []string) { |
| } |
| sess := requireAPISession("create", *consoleFlag) |
| printUsing(stdout, sess) |
| - rec, err := sess.instanceCreate(context.Background(), apiAccount(acctRaw, acctIDRaw), *app, |
| + rec, err := sess.instanceCreate(context.Background(), resolvedAccount(sess, acctRaw, acctIDRaw), *app, |
| strings.TrimSpace(*host), strings.TrimSpace(*region), strings.TrimSpace(*channel)) |
| if err != nil { |
| log.Fatalf("instances create: %v", err) |
| @@ -264,14 +264,14 @@ func runInstancesList(args []string) { |
| match := fs.String("match", "", "only hosts containing this substring") |
| health := fs.String("health", "", "only this state: running, serving, setting-up, asleep, no-readings, not-responding, failed") |
| consoleFlag := fs.String("console", "", "console to list through (default: the only logged-in one)") |
| - acctRaw := fs.String("account", "ops", "account (sqid or name) the app belongs to") |
| + acctRaw := fs.String("account", "", "account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)") |
| acctIDRaw := fs.String("account-id", "", "account sqid, matched as a sqid ONLY — supersedes -account") |
| fs.Parse(args) |
| if *app == "" { |
| log.Fatal(instancesRecordsUsage) |
| } |
| sess := requireAPISession("list", *consoleFlag) |
| - recs, truncated, total, err := sess.instanceList(context.Background(), apiAccount(acctRaw, acctIDRaw), *app, *match, *health) |
| + recs, truncated, total, err := sess.instanceList(context.Background(), resolvedAccount(sess, acctRaw, acctIDRaw), *app, *match, *health) |
| if err != nil { |
| log.Fatalf("instances list: %v", err) |
| } |
| @@ -304,7 +304,7 @@ func runInstancesDelete(args []string) { |
| app := fs.String("app", "", "app the instance belongs to") |
| host := fs.String("host", "", "instance host whose record to retire") |
| consoleFlag := fs.String("console", "", "console to delete through (default: the only logged-in one)") |
| - acctRaw := fs.String("account", "ops", "account (sqid or name) the app belongs to") |
| + acctRaw := fs.String("account", "", "account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)") |
| acctIDRaw := fs.String("account-id", "", "account sqid, matched as a sqid ONLY — supersedes -account") |
| fs.Parse(args) |
| if *app == "" || *host == "" { |
| @@ -312,7 +312,7 @@ func runInstancesDelete(args []string) { |
| } |
| sess := requireAPISession("delete", *consoleFlag) |
| printUsing(stdout, sess) |
| - if err := sess.instanceDelete(context.Background(), apiAccount(acctRaw, acctIDRaw), *app, strings.TrimSpace(*host)); err != nil { |
| + if err := sess.instanceDelete(context.Background(), resolvedAccount(sess, acctRaw, acctIDRaw), *app, strings.TrimSpace(*host)); err != nil { |
| log.Fatalf("instances delete: %v", err) |
| } |
| fmt.Fprintf(stdout, "%s %s — its route retires on the next reconcile pass; parked data stays\n", |
diff --git a/logs.go b/logs.go| index 558f7fdb0..dd267d1db 100644 |
| --- a/logs.go |
| +++ b/logs.go |
| @@ -67,7 +67,7 @@ func runLogs(args []string) { |
| n := fs.Int("n", 0, "at most this many lines (default 1000, max 5000)") |
| follow := fs.Bool("f", false, "follow: poll for new lines until interrupted") |
| consoleFlag := fs.String("console", "", "console to read through (default: the only logged-in one)") |
| - acctRaw := fs.String("account", "ops", "account (sqid or name) the app belongs to") |
| + acctRaw := fs.String("account", "", "account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)") |
| acctIDRaw := fs.String("account-id", "", "account sqid, matched as a sqid ONLY — supersedes -account") |
| fs.Usage = func() { fmt.Fprint(os.Stderr, logsUsage) } |
| fs.Parse(args) |
| @@ -92,7 +92,7 @@ func runLogs(args []string) { |
| } |
| sess := requireAPISession("logs", *consoleFlag) |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| ctx := context.Background() |
| res, err := sess.logsGet(ctx, acct, *app, q) |
| if err != nil { |
diff --git a/restart.go b/restart.go| index 25c9e5a31..7a9173dfa 100644 |
| --- a/restart.go |
| +++ b/restart.go |
| @@ -38,7 +38,7 @@ func runRestart(args []string) { |
| } |
| sess := requireRestartAPISession(*consoleFlag) |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| printUsing(stdout, sess) |
| res, err := sess.restart(context.Background(), acct, name) |
| if err != nil { |
diff --git a/retention.go b/retention.go| index f031cded9..af24adda2 100644 |
| --- a/retention.go |
| +++ b/retention.go |
| @@ -51,7 +51,7 @@ func runReleasesRetention(args []string) { |
| } |
| sess := requireRetentionAPISession(*consoleFlag) |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| printUsing(stdout, sess) |
| ctx := context.Background() |
| switch { |
diff --git a/store.go b/store.go| index 3192348bb..06bf9e8a2 100644 |
| --- a/store.go |
| +++ b/store.go |
| @@ -142,7 +142,7 @@ func runStoreCreate(args []string) { |
| } |
| sess := requireStoreAPISession(*consoleFlag) |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| printUsing(stdout, sess) |
| res, err := sess.storeCreate(context.Background(), acct, name, strings.TrimSpace(*envPrefix)) |
| if err != nil { |
| @@ -166,7 +166,7 @@ func runStoreStatus(args []string) { |
| } |
| sess := requireStoreAPISession(*consoleFlag) |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| printUsing(stdout, sess) |
| res, err := sess.storeGet(context.Background(), acct, name) |
| if err != nil { |
| @@ -191,7 +191,7 @@ func runStoreGrant(args []string) { |
| } |
| sess := requireStoreAPISession(*consoleFlag) |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| printUsing(stdout, sess) |
| res, err := sess.storeGrant(context.Background(), acct, name, strings.TrimSpace(*bucket)) |
| if err != nil { |
| @@ -216,7 +216,7 @@ func runStoreRotate(args []string) { |
| } |
| sess := requireStoreAPISession(*consoleFlag) |
| - acct := apiAccount(acctRaw, acctIDRaw) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| printUsing(stdout, sess) |
| res, err := sess.storeRotate(context.Background(), acct, name, *finish) |
| if err != nil { |