diff --git a/webhook/processConfig.ts b/webhook/processConfig.ts index 8fb9706..1495df5 100644 --- a/webhook/processConfig.ts +++ b/webhook/processConfig.ts @@ -1,5 +1,6 @@ /* eslint-disable complexity */ import { setTimeout as setPromisedTimeout } from 'timers/promises' +import { writeFile } from 'fs' import { createFile as touch, readJSON, remove, writeJSON } from 'fs-promise' import execa, { ExecaChildProcess, ExecaSyncReturnValue } from 'execa' @@ -84,6 +85,21 @@ const status: Status = { } } = require(`../${PELIAS_CONFIG_FILE}`) + if (config.peliasSynonymsBase64) { + await updateStatus({ message: 'Importing synonyms', percentComplete: 10.0 }) + writeFile( + '../pelias-config/synonyms/custom_name.txt', + config.peliasSynonymsBase64.replace('data:text/plain;base64,', ''), + { encoding: 'base64' }, + function (err) { + console.log('File created') + if (err) { + console.log(err) + } + } + ) + } + await updateStatus({ message: 'Downloading GTFS feeds', percentComplete: 20.0 diff --git a/webhook/utils.ts b/webhook/utils.ts index 5df21c4..c8b4022 100644 --- a/webhook/utils.ts +++ b/webhook/utils.ts @@ -14,6 +14,7 @@ export type WebhookConfig = { deploymentId: string gtfsFeeds: Array<{ filename: string; name: string; uri: string }> logUploadUrl: string + peliasSynonymsBase64?: string resetDb: boolean workerId: string }