"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const upload_1 = require("@midwayjs/upload");
const os_1 = require("os");
const path = require("path");
exports.default = {
    session: {
        renew: true,
    },
    validate: {
        validationOptions: {
            allowUnknown: true,
        },
    },
    cors: {
        credentials: true,
        exposeHeaders: ['Authorization', 'Content-Disposition', 'Date'],
        origin: (ctx) => {
            return ctx.header.origin;
        },
    },
    typeorm: {
        dataSource: {
            default: {
                _name: '默认数据源',
                _key: 'default',
                _dialect: 'sqlite',
                type: 'sqlite',
                database: path.join(process.cwd(), 'database.sqlite'),
                synchronize: false,
                logging: false,
                extra: {},
            },
        },
    },
    upload: {
        // mode: UploadMode, 默认为file，即上传到服务器临时目录，可以配置为 stream
        mode: 'file',
        // fileSize: string, 最大上传文件大小，默认为 10mb
        fileSize: '10mb',
        // whitelist: string[]，文件扩展名白名单
        whitelist: [...upload_1.uploadWhiteList, '.log'],
        // tmpdir: string，上传的文件临时存储路径
        tmpdir: path.join((0, os_1.tmpdir)(), 'midway-upload-files'),
        // cleanTimeout: number，上传的文件在临时目录中多久之后自动删除，默认为 5 分钟
        cleanTimeout: 5 * 60 * 1000,
        // base64: boolean，设置原始body是否是base64格式，默认为false，一般用于腾讯云的兼容
        base64: false,
    },
    staticFile: {
        dirs: {
            default: {
                prefix: '/magic-editor',
                dir: path.join(__dirname, '../..', 'magic-editor'),
            },
        },
    },
    midwayLogger: {
        clients: {
            magic: {
                fileLogName: 'magic-node.log',
            },
        },
    },
    magic: {
        prefix: '/magic',
        editorConfigPath: path.normalize(path.join(process.cwd(), 'static', 'js', 'editor-config.js')),
        typesPath: path.normalize(path.join(process.cwd(), 'static', 'types')),
        security: [],
        resource: {
            type: 'file',
            location: '/data/script',
            tableName: 'magic_resource',
        },
        crud: {
            logicDeleteColumn: 'deleted',
            logicDeleteValue: 1,
        },
        openapi: {
            enabled: true,
            route: {
                tags: ['Magic接口服务'],
                // deprecated: true,
                security: [
                    {
                        ApiKeyAuth: [],
                    },
                ],
            },
            info: {
                title: 'Magic-Node',
                description: 'Magic-Node 接口定义',
                version: '1.0',
            },
            components: {
                securitySchemes: {
                    ApiKeyAuth: {
                        type: 'apiKey',
                        in: 'header',
                        name: 'Authorization',
                    },
                },
            },
        },
    },
};
//# sourceMappingURL=config.default.js.map