mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
add server to monorepo.
This commit is contained in:
59
packages/server/src/config/knexConfig.ts
Normal file
59
packages/server/src/config/knexConfig.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import config from '@/config';
|
||||
import { ITenant } from '@/interfaces';
|
||||
|
||||
export const tenantKnexConfig = (tenant: ITenant) => {
|
||||
const { organizationId, id } = tenant;
|
||||
|
||||
return {
|
||||
client: config.tenant.db_client,
|
||||
connection: {
|
||||
host: config.tenant.db_host,
|
||||
user: config.tenant.db_user,
|
||||
password: config.tenant.db_password,
|
||||
database: `${config.tenant.db_name_prefix}${organizationId}`,
|
||||
charset: config.tenant.charset,
|
||||
},
|
||||
migrations: {
|
||||
directory: config.tenant.migrations_dir,
|
||||
},
|
||||
seeds: {
|
||||
tableName: 'bigcapital_seeds',
|
||||
directory: config.tenant.seeds_dir,
|
||||
},
|
||||
pool: { min: 0, max: 5 },
|
||||
userParams: {
|
||||
tenantId: id,
|
||||
organizationId
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const systemKnexConfig = {
|
||||
client: config.system.db_client,
|
||||
connection: {
|
||||
host: config.system.db_host,
|
||||
user: config.system.db_user,
|
||||
password: config.system.db_password,
|
||||
database: config.system.db_name,
|
||||
charset: 'utf8',
|
||||
},
|
||||
migrations: {
|
||||
directory: config.system.migrations_dir,
|
||||
},
|
||||
seeds: {
|
||||
directory: config.system.seeds_dir,
|
||||
},
|
||||
pool: { min: 0, max: 7 },
|
||||
};
|
||||
|
||||
export const systemDbManager = {
|
||||
collate: [],
|
||||
superUser: config.manager.superUser,
|
||||
superPassword: config.manager.superPassword,
|
||||
};
|
||||
|
||||
export const tenantSeedConfig = (tenant: ITenant) => {
|
||||
return {
|
||||
directory: config.tenant.seeds_dir,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user