From 507ea6c6be2ba6472dd3731f32e2afaea28679d6 Mon Sep 17 00:00:00 2001 From: Alejo Thomas Ortega Date: Thu, 7 Mar 2024 11:15:28 -0300 Subject: [PATCH] fix: properly remove license-builder component --- consumer-server/src/components.ts | 3 --- consumer-server/src/utils/license-builder.ts | 22 -------------------- 2 files changed, 25 deletions(-) delete mode 100644 consumer-server/src/utils/license-builder.ts diff --git a/consumer-server/src/components.ts b/consumer-server/src/components.ts index d74388de..688cf24b 100644 --- a/consumer-server/src/components.ts +++ b/consumer-server/src/components.ts @@ -8,7 +8,6 @@ import { AppComponents, GlobalContext } from './types' import { metricDeclarations } from './metrics' import { createSqsAdapter } from './adapters/sqs' import { createMessagesConsumerComponent } from './logic/message-consumer' -import { buildLicense } from './utils/license-builder' import { createLodGeneratorComponent } from './logic/lod-generator' import { createMessageHandlerComponent } from './logic/message-handler' import { createCloudStorageAdapter } from './adapters/storage' @@ -41,8 +40,6 @@ export async function initComponents(): Promise { const messageConsumer = await createMessagesConsumerComponent({ logs, queue, messageHandler }) - //await buildLicense({ config, logs }) - return { config, logs, diff --git a/consumer-server/src/utils/license-builder.ts b/consumer-server/src/utils/license-builder.ts deleted file mode 100644 index 7549e8bf..00000000 --- a/consumer-server/src/utils/license-builder.ts +++ /dev/null @@ -1,22 +0,0 @@ -import path from 'path' -import fs from 'fs' - -import { AppComponents } from '../types' - -export async function buildLicense({ config, logs }: Pick): Promise { - const logger = logs.getLogger('license-builder') - const licenseKey = (await config.getString('LODS_GENERATOR_LICENSE')) || '' // this is a SSM parameter pulled from AWS - const projectRoot = path.resolve(__dirname, '..', '..', '..') - - try { - const licenseKeyPath = path.resolve(projectRoot, 'pixyzsdk-29022024.lic') - const licenseKeyFile = fs.readFileSync(licenseKeyPath, 'utf8') - const replacedLicenseKey = licenseKeyFile.replace('{LICENSE_KEY}', licenseKey) - - fs.writeFileSync(licenseKeyPath, replacedLicenseKey, 'utf8') - logger.info('PiXYZ license built correctly') - } catch (error: any) { - logger.error('Could not build PiXYZ license', { error: error.message.replace(licenseKey, '****') || '' }) - throw error - } -}