- 在package.json中添加GPL-3.0许可证声明 - 创建LICENSE文件包含完整GPL-3.0许可证文本 - 更新README.md中的许可证章节,详细说明GPL-3.0要点 - 在所有主要源代码文件头部添加GPL-3.0版权声明 - 新增CONTRIBUTING.md贡献指南文档
51 lines
1.7 KiB
TypeScript
51 lines
1.7 KiB
TypeScript
/*
|
|
* Next WindFonts - 现代化字体管理和展示平台
|
|
* Copyright (C) 2025 WindFonts Project
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
import type { Config } from 'drizzle-kit';
|
|
import * as dotenv from 'dotenv';
|
|
|
|
// 加载环境变量
|
|
dotenv.config({ path: '.env.development' });
|
|
|
|
// 构建 PostgreSQL 连接字符串
|
|
function buildConnectionString(): string {
|
|
// 优先使用 POSTGRES_URL 环境变量
|
|
if (process.env.POSTGRES_URL) {
|
|
return process.env.POSTGRES_URL;
|
|
}
|
|
|
|
// 否则从分散的环境变量构建
|
|
const host = process.env.DATA_BASE_HOST || 'localhost';
|
|
const port = process.env.DATA_BASE_PORT || '5432';
|
|
const username = process.env.DATA_BASE_USER || 'postgres';
|
|
const password = process.env.DATA_BASE_PASSWORD || '';
|
|
const database = process.env.DATA_BASE_NAME || 'windfonts';
|
|
|
|
return `postgresql://${username}:${password}@${host}:${port}/${database}`;
|
|
}
|
|
|
|
export default {
|
|
schema: './src/lib/database/schema.ts',
|
|
out: './drizzle',
|
|
dialect: 'postgresql',
|
|
dbCredentials: {
|
|
url: buildConnectionString(),
|
|
},
|
|
verbose: true,
|
|
strict: true,
|
|
} satisfies Config;
|