(input: {
readonly baseUrl: Option.Option<string>;
readonly server: Option.Option<string>;
})
| 2457 | // nothing is configured yet. The profile name is decided later, from the |
| 2458 | // authenticated account. |
| 2459 | const resolveLoginOrigin = (input: { |
| 2460 | readonly baseUrl: Option.Option<string>; |
| 2461 | readonly server: Option.Option<string>; |
| 2462 | }): Effect.Effect< |
| 2463 | { readonly origin: string; readonly profile: ReturnType<typeof findCliServerConnectionProfile> }, |
| 2464 | Error, |
| 2465 | FileSystem.FileSystem | PlatformPath.Path |
| 2466 | > => |
| 2467 | Effect.gen(function* () { |
| 2468 | const baseUrl = Option.getOrUndefined(input.baseUrl); |
| 2469 | const serverName = Option.getOrUndefined(input.server); |
| 2470 | if (baseUrl && serverName) { |
| 2471 | return yield* Effect.fail(new Error("Use either --server or --base-url, not both.")); |
| 2472 | } |
| 2473 | if (serverName) { |
| 2474 | const store = yield* readCliServerConnectionStore(); |
| 2475 | const profile = findCliServerConnectionProfile(store, serverName); |
| 2476 | if (!profile) |
| 2477 | return yield* Effect.fail(new Error(`No server profile named "${serverName}".`)); |
| 2478 | return { origin: profile.connection.origin, profile }; |
| 2479 | } |
| 2480 | if (baseUrl) { |
| 2481 | return { origin: normalizeExecutorServerOrigin(baseUrl), profile: null }; |
| 2482 | } |
| 2483 | const store = yield* readCliServerConnectionStore(); |
| 2484 | const profile = defaultCliServerConnectionProfile(store); |
| 2485 | if (profile) return { origin: profile.connection.origin, profile }; |
| 2486 | return { origin: DEFAULT_LOGIN_ORIGIN, profile: null }; |
| 2487 | }); |
| 2488 | |
| 2489 | const loginNameOption = Options.string("name").pipe( |
| 2490 | Options.optional, |
no test coverage detected