(input: {
readonly baseUrl: Option.Option<string>;
readonly server: Option.Option<string>;
})
| 2333 | // nothing is configured yet. The profile name is decided later, from the |
| 2334 | // authenticated account. |
| 2335 | const resolveLoginOrigin = (input: { |
| 2336 | readonly baseUrl: Option.Option<string>; |
| 2337 | readonly server: Option.Option<string>; |
| 2338 | }): Effect.Effect< |
| 2339 | { readonly origin: string; readonly profile: ReturnType<typeof findCliServerConnectionProfile> }, |
| 2340 | Error, |
| 2341 | FileSystem.FileSystem | PlatformPath.Path |
| 2342 | > => |
| 2343 | Effect.gen(function* () { |
| 2344 | const baseUrl = Option.getOrUndefined(input.baseUrl); |
| 2345 | const serverName = Option.getOrUndefined(input.server); |
| 2346 | if (baseUrl && serverName) { |
| 2347 | return yield* Effect.fail(new Error("Use either --server or --base-url, not both.")); |
| 2348 | } |
| 2349 | if (serverName) { |
| 2350 | const store = yield* readCliServerConnectionStore(); |
| 2351 | const profile = findCliServerConnectionProfile(store, serverName); |
| 2352 | if (!profile) |
| 2353 | return yield* Effect.fail(new Error(`No server profile named "${serverName}".`)); |
| 2354 | return { origin: profile.connection.origin, profile }; |
| 2355 | } |
| 2356 | if (baseUrl) { |
| 2357 | return { origin: normalizeExecutorServerOrigin(baseUrl), profile: null }; |
| 2358 | } |
| 2359 | const store = yield* readCliServerConnectionStore(); |
| 2360 | const profile = defaultCliServerConnectionProfile(store); |
| 2361 | if (profile) return { origin: profile.connection.origin, profile }; |
| 2362 | return { origin: DEFAULT_LOGIN_ORIGIN, profile: null }; |
| 2363 | }); |
| 2364 | |
| 2365 | const loginNameOption = Options.string("name").pipe( |
| 2366 | Options.optional, |
no test coverage detected