Skip to content

Commit

Permalink
fix: 🐛 add config for PROCEDURES_SERVER_URL
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Ruck <[email protected]>
  • Loading branch information
Manuel Ruck committed Sep 22, 2024
1 parent b7c1864 commit 5427b10
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion bundestag.io/admin/.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ AI_SERVER_URL_CODEGEN=http://localhost:4003
AI_ACCESS_TOKEN=EMPTY
AI_SIMULATION=true
NON_NAMED_VOTES_AI_SERVER_URL=http://localhost:3005
NON_NAMED_VOTES_AI_SECRET=CHANGE_ME
NON_NAMED_VOTES_AI_SECRET=CHANGE_ME
PROCEDURES_SERVER_URL=http://localhost:3006
3 changes: 2 additions & 1 deletion bundestag.io/admin/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ AI_SERVER_URL_CODEGEN=http://localhost:4003
AI_ACCESS_TOKEN=EMPTY
AI_SIMULATION=true
NON_NAMED_VOTES_AI_SERVER_URL=http://localhost:3005
NON_NAMED_VOTES_AI_SECRET=CHANGE_ME
NON_NAMED_VOTES_AI_SECRET=CHANGE_ME
PROCEDURES_SERVER_URL=http://localhost:3006
2 changes: 2 additions & 0 deletions bundestag.io/admin/manifests/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ spec:
value: 'http://non-named-votes-ai'
- name: NON_NAMED_VOTES_AI_SECRET
value: ${var.NON_NAMED_VOTES_AI_SECRET}
- name: PROCEDURES_SERVER_URL
value: 'http://procedures'
ports:
- containerPort: 4003
name: http
Expand Down
3 changes: 2 additions & 1 deletion bundestag.io/admin/src/app/list/past/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { config } from '@/lib/config';
import Entry from '../_components/entry';
import { IProcedure } from '@democracy-deutschland/bundestagio-common';

Expand All @@ -24,7 +25,7 @@ export default async function Page() {
}

async function getData(): Promise<IProcedure[]> {
const res = await fetch('http://procedures/procedures/list/past', {
const res = await fetch(`${config.PROCEDURES_SERVER_URL}/procedures/list/past`, {
headers: {
'Cache-Control': 'no-cache',
cache: 'no-store',
Expand Down
3 changes: 2 additions & 1 deletion bundestag.io/admin/src/app/list/upcoming/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { config } from '@/lib/config';
import Entry from '../_components/entry';
import { IProcedure } from '@democracy-deutschland/bundestagio-common';

Expand All @@ -24,7 +25,7 @@ export default async function Page() {
}

async function getData(): Promise<IProcedure[]> {
const res = await fetch('http://procedures/procedures/list/upcoming', {
const res = await fetch(`${config.PROCEDURES_SERVER_URL}/procedures/list/upcoming`, {
headers: {
'Cache-Control': 'no-cache',
cache: 'no-store',
Expand Down
2 changes: 2 additions & 0 deletions bundestag.io/admin/src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { log } from './logger';

const errors: string[] = [];
const AI_SIMULATION = process.env.AI_SIMULATION === 'true';
const PROCEDURES_SERVER_URL = process.env.PROCEDURES_SERVER_URL ?? 'http://procedures';

if (!process.env.BUNDESTAGIO_SERVER_URL) {
errors.push('Please define the BUNDESTAGIO_SERVER_URL environment variable inside .env.local');
Expand All @@ -27,4 +28,5 @@ export const config = {
AI_SERVER_URL: process.env.AI_SERVER_URL,
AI_ACCESS_TOKEN: process.env.AI_ACCESS_TOKEN,
AI_SIMULATION: AI_SIMULATION,
PROCEDURES_SERVER_URL: PROCEDURES_SERVER_URL,
};

0 comments on commit 5427b10

Please sign in to comment.