Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
1f1db0e
Bump supertest to v7.1.1
ty2k May 12, 2025
e86018b
Add dotenv, knex, and pg dependencies
ty2k May 12, 2025
ce27f3b
Use dotenv for .env files
ty2k May 12, 2025
2cca7ea
Add DATABASE_URL to .env.example
ty2k May 12, 2025
d637698
Add knexfile with development and production database connections
ty2k May 12, 2025
8708a82
Use knexfile in db/index
ty2k May 12, 2025
0b7147f
Count rows in graphemes table in API route as test of database connec…
ty2k May 12, 2025
c819465
Add database connection for test environment
ty2k May 12, 2025
3d0f218
Warn if DATABASE_URL is undefined for CI runs
ty2k May 12, 2025
a4a80ab
Add try/catch around graphemes count in /api route
ty2k May 12, 2025
d8e2ff2
Merge pull request #54 from bcgov/feature/graphemes-api-db-connection
ty2k May 12, 2025
17bc3b0
Build Postgres connection string from multiple environment variables
ty2k May 13, 2025
ac5bfba
Merge pull request #55 from bcgov/feature/graphemes-api-db-connection
ty2k May 13, 2025
85b790d
Add dev OpenShift deployment YAML
ty2k May 14, 2025
5b14d3f
Add zod to graphemes-api dependencies
ty2k May 15, 2025
bd337df
Add Language model
ty2k May 15, 2025
06fe73b
Add /api/v1/languages endpoint
ty2k May 15, 2025
3129d63
Fix GET /api/v1/languages/:id to match db schema
ty2k May 15, 2025
93169cf
Merge pull request #56 from bcgov/feature/graphemes-api-db-connection
ty2k May 15, 2025
d960195
Add splitCommaSeparatedString() utility function
ty2k May 15, 2025
df64db9
Use common splitCommaSeparatedString() in LanguageSchema
ty2k May 15, 2025
4d4b594
Return early in splitCommaSeparatedString() if trimmed input is falsy
ty2k May 15, 2025
12254ad
Add single string test case
ty2k May 15, 2025
78b1cfd
Merge pull request #57 from bcgov/feature/filter-empty-strings
ty2k May 15, 2025
69217a9
Merge pull request #58 from bcgov/dev
ty2k May 15, 2025
8251ff7
Fix DB_PASS variable name in dev deployment
ty2k May 15, 2025
84acc79
Merge pull request #60 from bcgov/ci/db-pass-variable-name
ty2k May 15, 2025
5f1c05a
Add splitCommaSeparatedString() test for whitespace only input
ty2k May 15, 2025
792ad28
Merge pull request #61 from bcgov/ci/test-for-whitespace-only
ty2k May 15, 2025
fa4e5eb
Use structured log instead of string literal for case where language …
ty2k May 15, 2025
e62c8e8
Use %o parameter for error object in log
ty2k May 15, 2025
cbe806a
Merge pull request #62 from bcgov/bug/avoid-string-literal-with-user-…
ty2k May 15, 2025
e0b4092
Merge pull request #63 from bcgov/dev
ty2k May 15, 2025
2c53ab9
Add express-rate-limit dependency to grapheme-api
ty2k May 15, 2025
504f887
Add rate limiting middleware function
ty2k May 15, 2025
a59caf1
Fix comment
ty2k May 16, 2025
ebccf0f
Use environment variables for rate limit values
ty2k May 16, 2025
c86c306
Add rate limit configuration environment variables
ty2k May 16, 2025
3df29de
Merge pull request #64 from bcgov/feature/api-rate-limiting
ty2k May 16, 2025
650d402
Merge pull request #65 from bcgov/dev
ty2k May 16, 2025
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
10 changes: 10 additions & 0 deletions graphemes-api/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
# Postgres database connection
DB_HOST=
DB_NAME=
DB_PASS=
DB_PORT=
DB_USER=

# Express API server configuration
PORT=
RATE_LIMIT_MAX=
RATE_LIMIT_WINDOW_MS=
83 changes: 83 additions & 0 deletions graphemes-api/openshift/dev/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: graphemes-api
namespace: f343b4-dev
labels:
app: graphemes-api
app.kubernetes.io/component: graphemes-api
app.kubernetes.io/instance: graphemes-api
app.kubernetes.io/name: graphemes-api
app.kubernetes.io/part-of: graphemes-api
app.openshift.io/runtime: nodejs
app.openshift.io/runtime-namespace: f343b4-tools
app.openshift.io/runtime-version: dev
annotations:
alpha.image.policy.openshift.io/resolve-names: "*"
app.openshift.io/route-disabled: "false"
deployment.kubernetes.io/revision: "1"
image.openshift.io/triggers: '[{"from":{"kind":"ImageStreamTag","name":"graphemes-api:dev","namespace":"f343b4-tools"},"fieldPath":"spec.template.spec.containers[?(@.name==\"graphemes-api\")].image","paused":"false"}]'
openshift.io/generated-by: OpenShiftWebConsole
spec:
replicas: 2
selector:
matchLabels:
app: graphemes-api
template:
metadata:
creationTimestamp: null
labels:
app: graphemes-api
deployment: graphemes-api
annotations:
openshift.io/generated-by: OpenShiftWebConsole
spec:
containers:
- name: graphemes-api
image: "image-registry.openshift-image-registry.svc:5000/f343b4-tools/graphemes-api:dev"
ports:
- containerPort: 3000
protocol: TCP
env:
- name: DB_HOST
valueFrom:
secretKeyRef:
name: crunchy-postgres-pguser-graphemes-api-user
key: pgbouncer-host
- name: DB_PORT
valueFrom:
secretKeyRef:
name: crunchy-postgres-pguser-graphemes-api-user
key: pgbouncer-port
- name: DB_USER
valueFrom:
secretKeyRef:
name: crunchy-postgres-pguser-graphemes-api-user
key: user
- name: DB_PASS
valueFrom:
secretKeyRef:
name: crunchy-postgres-pguser-graphemes-api-user
key: password
- name: DB_NAME
# This is a literal value because `crunchy-postgres`
# is the default database name in the PostgresCluster.
# This database name does not appear in the Secret.
value: grapheme_v2
Copy link

Copilot AI May 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Hardcoding the database name in the manifest can lead to drift and exposes configuration details. Consider sourcing DB_NAME from a secret or ConfigMap to centralize environment configuration.

Copilot uses AI. Check for mistakes.
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
securityContext: {}
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600
Loading