mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 18:26:05 +08:00
refactor(core): initial multiple servers infra (#8745)
This is the initial refactoring of affine to support multiple servers, but many more changes are needed to make multi-server actually work.
This commit is contained in:
@@ -998,6 +998,7 @@ query serverConfig {
|
||||
name
|
||||
features
|
||||
type
|
||||
initialized
|
||||
credentialsRequirement {
|
||||
...CredentialsRequirement
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ query serverConfig {
|
||||
name
|
||||
features
|
||||
type
|
||||
initialized
|
||||
credentialsRequirement {
|
||||
...CredentialsRequirement
|
||||
}
|
||||
|
||||
@@ -2,23 +2,3 @@ export * from './error';
|
||||
export * from './fetcher';
|
||||
export * from './graphql';
|
||||
export * from './schema';
|
||||
|
||||
import { setupGlobal } from '@affine/env/global';
|
||||
|
||||
import { gqlFetcherFactory } from './fetcher';
|
||||
|
||||
setupGlobal();
|
||||
|
||||
export function getBaseUrl(): string {
|
||||
if (BUILD_CONFIG.isElectron || BUILD_CONFIG.isIOS || BUILD_CONFIG.isAndroid) {
|
||||
return BUILD_CONFIG.serverUrlPrefix;
|
||||
}
|
||||
if (typeof window === 'undefined') {
|
||||
// is nodejs
|
||||
return '';
|
||||
}
|
||||
const { protocol, hostname, port } = window.location;
|
||||
return `${protocol}//${hostname}${port ? `:${port}` : ''}`;
|
||||
}
|
||||
|
||||
export const fetcher = gqlFetcherFactory(getBaseUrl() + '/graphql');
|
||||
|
||||
@@ -2175,6 +2175,7 @@ export type ServerConfigQuery = {
|
||||
name: string;
|
||||
features: Array<ServerFeature>;
|
||||
type: ServerDeploymentType;
|
||||
initialized: boolean;
|
||||
credentialsRequirement: {
|
||||
__typename?: 'CredentialsRequirementType';
|
||||
password: {
|
||||
|
||||
Reference in New Issue
Block a user