Skip to content

Commit

Permalink
change FileUploadEnvVarType to FileUploadTypeForEnvVar
Browse files Browse the repository at this point in the history
  • Loading branch information
arafubeatbox committed Aug 27, 2024
1 parent 5f3ecef commit eac51eb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
IAttachment, IPage, IRevision, IUser, Ref,
} from '@growi/core';

import { FileUploadEnvVarType } from '~/interfaces/file-uploader';
import { FileUploadTypeForEnvVar } from '~/interfaces/file-uploader';

export const PageBulkExportFormat = {
md: 'md',
Expand Down Expand Up @@ -48,4 +48,4 @@ export interface IPageBulkExportPageSnapshot {
revision: Ref<IRevision>, // page revision when export was stared
}

export const PageBulkExportEnabledFileUploadTypes = [FileUploadEnvVarType.aws, FileUploadEnvVarType.gcs, FileUploadEnvVarType.gcp] as const;
export const PageBulkExportEnabledFileUploadTypes = [FileUploadTypeForEnvVar.aws, FileUploadTypeForEnvVar.gcs, FileUploadTypeForEnvVar.gcp] as const;
6 changes: 4 additions & 2 deletions apps/app/src/interfaces/file-uploader.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// file upload types actually supported by the app
export const FileUploadType = {
aws: 'aws',
gcs: 'gcs',
Expand All @@ -8,11 +9,12 @@ export const FileUploadType = {

export type FileUploadType = typeof FileUploadType[keyof typeof FileUploadType]

export const FileUploadEnvVarType = {
// file upload type strings you can specify in the env var
export const FileUploadTypeForEnvVar = {
...FileUploadType,
mongo: 'mongo',
mongodb: 'mongodb',
gcp: 'gcp',
} as const;

export type FileUploadEnvVarType = typeof FileUploadEnvVarType[keyof typeof FileUploadEnvVarType]
export type FileUploadTypeForEnvVar = typeof FileUploadTypeForEnvVar[keyof typeof FileUploadTypeForEnvVar]
4 changes: 2 additions & 2 deletions apps/app/src/server/service/file-uploader/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FileUploadEnvVarType } from '~/interfaces/file-uploader';
import { FileUploadTypeForEnvVar } from '~/interfaces/file-uploader';
import type Crowi from '~/server/crowi';
import loggerFactory from '~/utils/logger';

Expand All @@ -11,7 +11,7 @@ export type { FileUploader } from './file-uploader';
const logger = loggerFactory('growi:service:FileUploaderServise');

const envToModuleMappings = {
...FileUploadEnvVarType,
...FileUploadTypeForEnvVar,
mongo: 'gridfs',
mongodb: 'gridfs',
gcp: 'gcs',
Expand Down

0 comments on commit eac51eb

Please sign in to comment.