Skip to content

Commit

Permalink
Merge pull request #27 from ibi-group/jan-2024-repairs
Browse files Browse the repository at this point in the history
January 2024 Small Fixes
  • Loading branch information
miles-grant-ibigroup authored Feb 7, 2024
2 parents 4ac6fea + 809b43e commit 942ff03
Show file tree
Hide file tree
Showing 6 changed files with 6,538 additions and 3,661 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
- name: Use Node.js 20.x
uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 20.x

- name: Install packages
# the IBI Group TSDX fork has some dependency issues
Expand Down
2 changes: 1 addition & 1 deletion env.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CSV_ENABLED: true
CUSTOM_PELIAS_URL: http://<insert your Pelias endpoint here>/v1
GEOCODER: HERE # Options: HERE, PELIAS
TRANSIT_GEOCODER: (optional) OTP/PELIAS
TRANSIT_BASE_URL: (conditionally required) OTP instance when TRANSIT_GEOCODER=OTP
TRANSIT_BASE_URL: (conditionally required) OTP instance when TRANSIT_GEOCODER=OTP (/otp/routers/{routerId})

SECONDARY_GEOCODER: (optional) HERE/PELIAS
SECONDARY_GEOCODER_API_KEY: (optional) INSERT SECONDARY API KEY HERE
Expand Down
24 changes: 13 additions & 11 deletions handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,19 @@ const {
TRANSIT_GEOCODER
} = process.env

const redis = REDIS_HOST
? createCluster({
rootNodes: [
{
password: REDIS_KEY,
url: 'redis://' + REDIS_HOST
}
],
useReplicas: true
})
: null
// Severless... why!
const redis =
!!REDIS_HOST && REDIS_HOST !== 'null'
? createCluster({
rootNodes: [
{
password: REDIS_KEY,
url: 'redis://' + REDIS_HOST
}
],
useReplicas: true
})
: null
if (redis) redis.on('error', (err) => console.log('Redis Client Error', err))

// Ensure env variables have been set
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@
"@types/geojson": "^7946.0.8",
"@types/jest": "^26.0.24",
"semantic-release": "^17.4.4",
"serverless-offline": "^8.8.0",
"serverless": "^3.38.0",
"serverless-offline": "^13.3.2",
"tsdx": "https://github.com/ibi-group/tsdx"
},
"dependencies": {
"@babel/runtime": "^7.16.7",
"@bugsnag/js": "^7.11.0",
"@bugsnag/plugin-aws-lambda": "^7.11.0",
"@conveyal/lonlat": "^1.4.1",
"@opentripplanner/geocoder": "^1.4.1",
"@opentripplanner/geocoder": "^2.0.1",
"geolib": "^3.3.1",
"node-fetch": "^2.6.1",
"redis": "^4.1.0",
Expand Down
10 changes: 1 addition & 9 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
service: pelias-stitch
provider:
name: aws
runtime: nodejs16.x
runtime: nodejs20.x
vpc:
securityGroupIds:
- ${self:custom.secrets.LAMBDA_EXEC_SG}
Expand All @@ -27,9 +27,6 @@ provider:
SECONDARY_GEOCODE_EARTH_URL: ${self:custom.secrets.SECONDARY_GEOCODE_EARTH_URL, null}
custom:
secrets: ${file(env.yml)}
apiGatewayCaching:
enabled: true
ttlInSeconds: 3600 # defaults to the maximum allowed: 3600
functions:
autocomplete:
handler: handler.autocomplete
Expand All @@ -38,10 +35,6 @@ functions:
method: get
cors: true
path: autocomplete
caching:
enabled: true
cacheKeyParameters:
- name: request.querystring.text
search:
handler: handler.search
events:
Expand All @@ -59,4 +52,3 @@ functions:
plugins:
- serverless-plugin-typescript
- serverless-offline
- serverless-api-gateway-caching
Loading

0 comments on commit 942ff03

Please sign in to comment.