feat: add PUBLIC_INSTANCE_TYPE env var

This commit is contained in:
James Xylight committed 2025-09-06 22:07:30 -07:00
1 parent 1ed9bf36d6
commit 3ac8b10b55
9 files changed
+37 -68

No files matched your search

+11 -4
View File
@@ -1,13 +1,20 @@
import { env } from '$env/dynamic/public'
import * as types from './types'
export type ClientType =
| { name: 'lemmy'; baseUrl: '/api/v3' }
| { name: 'piefed'; baseUrl: '/api/alpha' }
export const DEFAULT_CLIENT_TYPE: ClientType = {
name: 'lemmy',
baseUrl: '/api/v3',
}
export const DEFAULT_CLIENT_TYPE: ClientType =
env.PUBLIC_INSTANCE_TYPE == 'piefedalpha'
? {
name: 'piefed',
baseUrl: '/api/alpha',
}
: {
name: 'lemmy',
baseUrl: '/api/v3',
}
export abstract class BaseClient {
abstract type: ClientType