aboutsummaryrefslogtreecommitdiff
path: root/packages/db/src/core/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/db/src/core/utils.ts')
-rw-r--r--packages/db/src/core/utils.ts37
1 files changed, 5 insertions, 32 deletions
diff --git a/packages/db/src/core/utils.ts b/packages/db/src/core/utils.ts
index b246997e2..3348e90a0 100644
--- a/packages/db/src/core/utils.ts
+++ b/packages/db/src/core/utils.ts
@@ -1,4 +1,3 @@
-import { type ManagedAppToken, getAstroStudioEnv, getManagedAppTokenOrExit } from '@astrojs/studio';
import type { AstroConfig, AstroIntegration } from 'astro';
import { loadEnv } from 'vite';
import './types.js';
@@ -11,49 +10,23 @@ export function getAstroEnv(envMode = ''): Record<`ASTRO_${string}`, string> {
}
export type RemoteDatabaseInfo = {
- type: 'libsql' | 'studio';
+ type: 'libsql';
url: string;
};
export function getRemoteDatabaseInfo(): RemoteDatabaseInfo {
const astroEnv = getAstroEnv();
- const studioEnv = getAstroStudioEnv();
-
- if (studioEnv.ASTRO_STUDIO_REMOTE_DB_URL)
- return {
- type: 'studio',
- url: studioEnv.ASTRO_STUDIO_REMOTE_DB_URL,
- };
-
- if (astroEnv.ASTRO_DB_REMOTE_URL)
- return {
- type: 'libsql',
- url: astroEnv.ASTRO_DB_REMOTE_URL,
- };
return {
- type: 'studio',
- url: 'https://db.services.astro.build',
+ type: 'libsql',
+ url: astroEnv.ASTRO_DB_REMOTE_URL,
};
}
-export function getManagedRemoteToken(
- token?: string,
- dbInfo?: RemoteDatabaseInfo,
-): Promise<ManagedAppToken> {
- dbInfo ??= getRemoteDatabaseInfo();
-
- if (dbInfo.type === 'studio') {
- return getManagedAppTokenOrExit(token);
- }
-
+export function getManagedRemoteToken(token?: string): string {
const astroEnv = getAstroEnv();
- return Promise.resolve({
- token: token ?? astroEnv.ASTRO_DB_APP_TOKEN,
- renew: () => Promise.resolve(),
- destroy: () => Promise.resolve(),
- });
+ return token ?? astroEnv.ASTRO_DB_APP_TOKEN;
}
export function getDbDirectoryUrl(root: URL | string) {