Skip to content

Commit

Permalink
Merge pull request #12 from ibi-group/custom-name-txt-support
Browse files Browse the repository at this point in the history
Support Pelias Synonyms File
  • Loading branch information
miles-grant-ibigroup authored Aug 9, 2023
2 parents 48337e8 + 4811e74 commit 137d78a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions webhook/processConfig.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions webhook/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 137d78a

Please sign in to comment.