Skip to content

Commit 763cdf2

Browse files
feat: accept --enable-infiniband flag on sf nodes create (#264)
Co-authored-by: indent[bot] <216979840+indent[bot]@users.noreply.github.com>
1 parent 4db68e8 commit 763cdf2

4 files changed

Lines changed: 398 additions & 370 deletions

File tree

src/index.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,21 @@ async function main() {
4242
.description("The San Francisco Compute command line tool.")
4343
.version(pkg.version);
4444

45+
// Hydrate `account_id` before registering commands so feature-flag-gated
46+
// surfaces (e.g. `--enable-infiniband` on `sf nodes create`) resolve
47+
// correctly on the very first CLI invocation after login, rather than only
48+
// appearing after the cache has been seeded by a previous run.
49+
const config = await loadConfig();
50+
let exchangeAccountId = config.account_id;
51+
if (!exchangeAccountId) {
52+
const client = await apiClient(config.auth_token);
53+
const { data } = await client.GET("/v1/account/me", {});
54+
if (data?.id) {
55+
exchangeAccountId = data.id;
56+
await saveConfig({ ...config, account_id: data.id });
57+
}
58+
}
59+
4560
// commands
4661
registerLogin(program);
4762
registerContracts(program);
@@ -84,18 +99,6 @@ async function main() {
8499
process.exit(0);
85100
});
86101

87-
const config = await loadConfig();
88-
let exchangeAccountId = config.account_id;
89-
90-
if (!exchangeAccountId) {
91-
const client = await apiClient(config.auth_token);
92-
const { data } = await client.GET("/v1/account/me", {});
93-
if (data?.id) {
94-
exchangeAccountId = data.id;
95-
saveConfig({ ...config, account_id: data.id });
96-
}
97-
}
98-
99102
program.exitOverride((error) => {
100103
let isError = true;
101104

0 commit comments

Comments
 (0)