mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 21:49:25 +08:00
* api/ui 改名为 server/client * 微调 * 继续完善 pages * Fix env file and file mode. (#1) * Fix: ignore .env file and environment variable names. * Fix: correct file mode. * fix: put environment variables together * fix: separate data and ui resourcer * feat: collection loader * feat: redirectTo * feat: fields & actions & views * feat: fields & actions * feat: app & pages & collections... * feat: collections & pages & permissions... * Doc: add readme (#2) * Doc: add README.md. * Util: add .editorconfig. * Fix: use glob ignore option instead of additional checking. (#3) * Fix: typo. (#4) * feat: permissions * feat: getCollection & getView actions * refactor: code cleanup Co-authored-by: Junyi <mytharcher@users.noreply.github.com>
38 lines
755 B
TypeScript
38 lines
755 B
TypeScript
import Database from '../database';
|
|
import { Options } from 'sequelize';
|
|
|
|
export const config: {
|
|
[key: string]: Options;
|
|
} = {
|
|
mysql: {
|
|
username: 'test',
|
|
password: 'test',
|
|
database: 'test',
|
|
host: '127.0.0.1',
|
|
port: 43306,
|
|
dialect: 'mysql',
|
|
},
|
|
postgres: {
|
|
username: 'test',
|
|
password: 'test',
|
|
database: 'test',
|
|
host: '127.0.0.1',
|
|
port: 45432,
|
|
dialect: 'postgres',
|
|
define: {
|
|
hooks: {
|
|
beforeCreate(model, options) {
|
|
|
|
},
|
|
},
|
|
},
|
|
// logging: false,
|
|
},
|
|
};
|
|
|
|
export function getDatabase(options: Options = {}) {
|
|
// console.log(process.env.DB_DIALECT);
|
|
const db = new Database({...config[process.env.DB_DIALECT||'postgres'], ...options});
|
|
return db;
|
|
};
|