feat: clear app.config.json5

This commit is contained in:
2025-03-26 00:55:03 +08:00
parent 501a92eb88
commit 7d93f0eef3
15 changed files with 356 additions and 426 deletions

View File

@@ -1,7 +1,6 @@
import { useConfig } from '@kevisual/use-config';
import { Sequelize } from 'sequelize';
type PostgresConfig = {
import { config } from './config.ts';
export type PostgresConfig = {
postgres: {
username: string;
password: string;
@@ -10,14 +9,17 @@ type PostgresConfig = {
database: string;
};
};
const config = useConfig<PostgresConfig>();
const postgresConfig = config.postgres;
if (!postgresConfig) {
console.error('postgres config is required');
if (!config.POSTGRES_PASSWORD || !config.POSTGRES_USER) {
console.error('postgres config is required password and user');
process.exit(1);
}
const postgresConfig = {
username: config.POSTGRES_USER,
password: config.POSTGRES_PASSWORD,
host: config.POSTGRES_HOST || 'localhost',
port: parseInt(config.POSTGRES_PORT || '5432'),
database: config.POSTGRES_DB || 'postgres',
};
// connect to db
export const sequelize = new Sequelize({
dialect: 'postgres',