Skip to content

Commit

Permalink
Add internalApiUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
bmaz committed Jul 23, 2024
1 parent ae9c9e2 commit 22064d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions k8s/overlays/prod/sciencespo/env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,7 @@ spec:
env:
- name: BACKEND_HOST
value: django.resin-sciencespo.svc.cluster.local
- name: INTERNAL_API_URL
value: http://localhost
- name: API_URL
value: https://resin.medialab.sciences-po.fr
13 changes: 9 additions & 4 deletions src/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const imageFolder = path.join("assets", "images");
const baseImageFolder = path.join(baseUrl, imageFolder);

const apiUrl = process.env.API_URL || "http://localhost:8000";
const internalApiUrl = process.env.INTERNAL_API_URL || "http://localhost:8000";

// Configure nunjucks
const env = nunjucks.configure(path.join(siteUrl, "templates"));
Expand All @@ -50,17 +51,21 @@ async function main() {
fs.removeSync(baseUrl);
await fs.ensureDir(baseImageFolder);

const fieldsTreeResponse = await fetch(apiUrl + "/api/fields/", { agent });
const fieldsTreeResponse = await fetch(internalApiUrl + "/api/fields/", {
agent,
});
const fieldsTree = await fieldsTreeResponse.json();

const skillsTreeResponse = await fetch(apiUrl + "/api/skills/", { agent });
const skillsTreeResponse = await fetch(internalApiUrl + "/api/skills/", {
agent,
});
const skillsTree = await skillsTreeResponse.json();
const idToLabel = formatSkills(fieldsTree, skillsTree);

const members = await fetch(apiUrl + "/api/members/", { agent });
const members = await fetch(internalApiUrl + "/api/members/", { agent });
const membersJson = await members.json();

const languages = await fetch(apiUrl + "/api/languages/", { agent });
const languages = await fetch(internalApiUrl + "/api/languages/", { agent });
const languagesJson = await languages.json();
const idToLanguage = formatLanguages(languagesJson);

Expand Down

0 comments on commit 22064d8

Please sign in to comment.