chore(server): local data migration env (#9080)

This commit is contained in:
liuyi
2024-12-10 12:42:59 +09:00
committed by GitHub
parent 4d44bcc145
commit 95597ec139
4 changed files with 14 additions and 8 deletions

View File

@@ -4,7 +4,7 @@ import { AppStartupConfig } from './types';
export type EnvConfigType = 'string' | 'int' | 'float' | 'boolean';
export type ServerFlavor = 'allinone' | 'graphql' | 'sync' | 'renderer';
export type AFFINE_ENV = 'dev' | 'beta' | 'production';
export type NODE_ENV = 'development' | 'test' | 'production';
export type NODE_ENV = 'development' | 'test' | 'production' | 'script';
export enum DeploymentType {
Affine = 'affine',
@@ -25,7 +25,12 @@ export interface PreDefinedAFFiNEConfig {
readonly isSelfhosted: boolean;
readonly flavor: { type: string } & { [key in ServerFlavor]: boolean };
readonly affine: { canary: boolean; beta: boolean; stable: boolean };
readonly node: { prod: boolean; dev: boolean; test: boolean };
readonly node: {
prod: boolean;
dev: boolean;
test: boolean;
script: boolean;
};
readonly deploy: boolean;
}

View File

@@ -18,6 +18,7 @@ function getPredefinedAFFiNEConfig(): PreDefinedAFFiNEConfig {
'development',
'test',
'production',
'script',
]);
const AFFINE_ENV = readEnv<AFFINE_ENV>('AFFINE_ENV', 'dev', [
'dev',
@@ -47,6 +48,7 @@ function getPredefinedAFFiNEConfig(): PreDefinedAFFiNEConfig {
prod: NODE_ENV === 'production',
dev: NODE_ENV === 'development',
test: NODE_ENV === 'test',
script: NODE_ENV === 'script',
};
return {

View File

@@ -35,9 +35,9 @@ export type GraphqlContext = {
},
autoSchemaFile: join(
fileURLToPath(import.meta.url),
config.node.test
? '../../../../node_modules/.cache/schema.gql'
: '../../../schema.gql'
config.node.dev
? '../../../schema.gql'
: '../../../../node_modules/.cache/schema.gql'
),
sortSchema: true,
context: ({