diff --git a/packages/backend/src/database.ts b/packages/backend/src/database.ts index 41a73b9d..7cefbaa2 100644 --- a/packages/backend/src/database.ts +++ b/packages/backend/src/database.ts @@ -34,9 +34,8 @@ const nanoid = customAlphabet(lowercase + numbers, 8); // TODO: Fix order of methods export class Database { private dataSource: DataSource; - private projectDomain: string; - constructor({ dbPath }: DatabaseConfig, { projectDomain }: MiscConfig) { + constructor({ dbPath }: DatabaseConfig) { this.dataSource = new DataSource({ type: 'better-sqlite3', database: dbPath, @@ -44,8 +43,6 @@ export class Database { synchronize: true, logging: false }); - - this.projectDomain = projectDomain; } async init(): Promise { @@ -491,13 +488,13 @@ export class Database { return projectRepository.save(newProject); } - async saveProject (project: Project): Promise { + async saveProject(project: Project): Promise { const projectRepository = this.dataSource.getRepository(Project); return projectRepository.save(project); } - async updateProjectById ( + async updateProjectById( projectId: string, data: DeepPartial ): Promise { @@ -583,7 +580,7 @@ export class Database { return domains; } - async addDeployer (data: DeepPartial): Promise { + async addDeployer(data: DeepPartial): Promise { const deployerRepository = this.dataSource.getRepository(Deployer); const newDomain = await deployerRepository.save(data); diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts index c6f0b3c6..629bd6e7 100644 --- a/packages/backend/src/index.ts +++ b/packages/backend/src/index.ts @@ -25,7 +25,7 @@ export const main = async (): Promise => { clientSecret: gitHub.oAuth.clientSecret, }); - const db = new Database(database, misc); + const db = new Database(database); await db.init(); const registry = new Registry(registryConfig); diff --git a/packages/backend/test/publish-deploy-records.ts b/packages/backend/test/publish-deploy-records.ts index cb40e032..26e0823a 100644 --- a/packages/backend/test/publish-deploy-records.ts +++ b/packages/backend/test/publish-deploy-records.ts @@ -38,7 +38,7 @@ async function main() { }); for await (const deployment of deployments) { - const url = `https://${deployment.project.name}-${deployment.id}.${misc.projectDomain}`; + const url = `https://${(deployment.project.name).toLowerCase()}-${deployment.id}.${deployment.deployer.baseDomain}`; const applicationDeploymentRecord = { type: 'ApplicationDeploymentRecord', @@ -73,7 +73,7 @@ async function main() { // Remove deployment for project subdomain if deployment is for production environment if (deployment.environment === Environment.Production) { - applicationDeploymentRecord.url = `https://${deployment.project.name}.${deployment.baseDomain}`; + applicationDeploymentRecord.url = `https://${deployment.project.name}.${deployment.deployer.baseDomain}`; await registry.setRecord( {