🔨 REFACTOR: Ready for Migrations

This commit is contained in:
2025-02-01 12:52:54 +00:00
parent da01b2b587
commit 56756d7c85
12 changed files with 106 additions and 861 deletions

View File

@@ -2,10 +2,13 @@
import path from 'path';
import { ConnectionOptions } from 'typeorm';
// import { DataSourceOptions } from 'typeorm';
import { WinstonLogger, RedisSessionCachePlugin, LogLevel, TypeOrmLogger, SystemConfig, DefaultJobQueuePlugin, TypeORMHealthCheckStrategy } from '@phoenix/core';
import { WinstonLogger, RedisSessionCachePlugin, LogLevel, TypeOrmLogger, SystemConfig, DefaultJobQueuePlugin } from '@phoenix/core';
import { AssetServerPlugin } from '@phoenix/asset-server-plugin';
import { ADMIN_API_PATH, API_PORT, SHOP_API_PATH, SUPER_ADMIN_USER_IDENTIFIER, WORKER_PORT } from '@phoenix/common';
import { ADMIN_API_PATH, API_PORT, SHOP_API_PATH, SUPER_ADMIN_USER_IDENTIFIER } from '@phoenix/common';
import { EmailPlugin, FileBasedTemplateLoader, defaultEmailHandlers } from '@phoenix/email-plugin';
import { BillBeePlugin } from "@phoenix/bill-bee-plugin";
import { ChannelPilotProPlugin } from "@phoenix/channel-pilot-pro-plugin";
import { ShopifyPlugin } from '@phoenix/shopify-plugin';
//import { BonnAPIPlugin } from '../plugins/bonn-api-plugin/bonn-api-plugin.module';
// import { DefaultJobQueuePlugin } from '@phoenix/system_service';
@@ -15,7 +18,6 @@ import { EmailPlugin, FileBasedTemplateLoader, defaultEmailHandlers } from '@pho
export const customConfig: SystemConfig = {
apiOptions: {
port: API_PORT,
workerPort: WORKER_PORT,
// sslPort: API_SSL_PORT,
//sslCertPath: path.join(__dirname, '../secrets/certificate.crt'),
//sslKeyPath: path.join(__dirname, '../secrets/certificate.key'),
@@ -100,6 +102,47 @@ export const customConfig: SystemConfig = {
changeEmailAddressUrl: 'http://localhost:4201/change-email-address',
}
}),
BillBeePlugin.init({
active: process.env.BILL_BEE_ACTIVE === 'true',
apiUrl: process.env.BILL_BEE_API_URL,
apiKey: process.env.BILL_BEE_API_KEY,
username: process.env.BILL_BEE_API_USERNAME,
password: process.env.BILL_BEE_API_SECRET,
header: {
'X-Billbee-Api-Key': process.env.BILL_BEE_API_KEY,
'Authorization': `Basic ${Buffer.from(`${process.env.BILL_BEE_API_USERNAME}:${process.env.BILL_BEE_API_SECRET}`).toString('base64')}`,
}
}),
ChannelPilotProPlugin.init({
active: process.env.CHANNEL_PILOT_PRO_ACTIVE === 'true',
connectionInfo: {
url: process.env.CHANNEL_PILOT_PRO_URL,
apiMerchantId: process.env.CHANNEL_PILOT_PRO_API_MERCHANT_ID,
apiToken: process.env.CHANNEL_PILOT_PRO_API_TOKEN,
access_token: process.env.CHANNEL_PILOT_PRO_ACCESS_TOKEN,
expiredAt: process.env.CHANNEL_PILOT_PRO_EXPIRED_AT,
tokenType: 'Bearer'
},
header: {
'Authorization': `Bearer ${process.env.CHANNEL_PILOT_PRO_ACCESS_TOKEN}`,
}
}),
ShopifyPlugin.init({
active: process.env.SHOPIFY_ACTIVE === 'true',
connectionInfo: {
url: process.env.SHOPIFY_HOST_NAME,
apiKey: process.env.SHOPIFY_API_KEY,
apiSecretKey: process.env.SHOPIFY_API_SECRET,
token: process.env.SHOPIFY_TOKEN,
// scopes: process.env.SHOPIFY_SCOPES.split(','),
hostName: process.env.SHOPIFY_HOST_NAME,
hostScheme: process.env.SHOPIFY_HOST_SCHEME === 'https' ? 'https' : 'http',
isEmbeddedApp: process.env.SHOPIFY_IS_EMBEDDED_APP === 'true',
header: {
'X-Shopify-Access-Token': process.env.SHOPIFY_TOKEN,
}
}
}),
// DefaultStoragePlaceRankPlugin.init({})
// new DefaultSearchPlugin(),
// new ElasticsearchPlugin({
@@ -117,11 +160,7 @@ export const customConfig: SystemConfig = {
// new AdminUiPlugin({
// port: 5001,
// }),
],
systemOptions: {
healthChecks: [new TypeORMHealthCheckStrategy(null, { key: 'database', timeout: 1000 })],
errorHandlers: [],
},
]
// ApolloEngineApiKey: "service:Logic-Bits-2900:5w1aCP5YUtF-1ErRG0KNQw"
};
@@ -149,7 +188,7 @@ function getDbConfig(): ConnectionOptions {
case 'postgres':
console.log('Using postgres connection at ' + dbHost);
return {
synchronize: true,
synchronize: false,
type: 'postgres',
//host: '127.0.0.1',
host: dbHost,