feat: clear app.config.json5
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user