Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Pelias Synonyms File #12

Merged
merged 2 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')
miles-grant-ibigroup marked this conversation as resolved.
Show resolved Hide resolved
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
Loading