The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { ConfigError } from "@distilled.cloud/core/errors"; |
| 2 | import { Credentials } from "@distilled.cloud/hetzner"; |
| 3 | import { lazyCredentials } from "alchemy/Auth/Resolve"; |
| 4 | import * as Layer from "effect/Layer"; |
| 5 | import { HETZNER_AUTH_PROVIDER_NAME, type HetznerResolvedCredentials } from "./AuthProvider.ts"; |
| 6 | |
| 7 | export { |
| 8 | Credentials, |
| 9 | CredentialsFromEnv, |
| 10 | credentials, |
| 11 | DEFAULT_API_BASE_URL, |
| 12 | type Config as CredentialsConfig, |
| 13 | } from "@distilled.cloud/hetzner"; |
| 14 | |
| 15 | /** |
| 16 | * Build a `Credentials` layer that resolves Hetzner credentials via the |
| 17 | * Alchemy AuthProvider using the configured profile (defaults to "default", |
| 18 | * overridable with the `ALCHEMY_PROFILE` env/config value). |
| 19 | * |
| 20 | * Maps onto `@distilled.cloud/hetzner`'s `{ token, apiBaseUrl }` shape. |
| 21 | */ |
| 22 | export const fromAuthProvider = () => |
| 23 | Layer.effect( |
| 24 | Credentials, |
| 25 | lazyCredentials<HetznerResolvedCredentials, ConfigError>()( |
| 26 | HETZNER_AUTH_PROVIDER_NAME, |
| 27 | (creds) => ({ |
| 28 | token: creds.token, |
| 29 | apiBaseUrl: creds.apiBaseUrl, |
| 30 | }), |
| 31 | ), |
| 32 | ); |