From 219ffb7723596d96e9789457b7c9bca05411a422 Mon Sep 17 00:00:00 2001 From: Kevin Yu Date: Thu, 29 Aug 2024 15:55:04 -0400 Subject: [PATCH] Port internal CTF uploads fixes --- README.md | 11 +++++++---- next.config.js | 8 +++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0ea6318..5badb74 100644 --- a/README.md +++ b/README.md @@ -21,14 +21,17 @@ To run just the frontend, first install dependencies with ```bash npm i ``` -In `next.config.js`, set `env.API_URL` to the public API URL of the rCTF instance, and `KLODD_URL` to the public URL of +In `next.config.js`, set `RCTF_BASE` to the public URL of the backend rCTF instance, and `KLODD_URL` to the public URL of the Klodd instancer frontend: ```js +const RCTF_BASE = 'http://ctf.b01lers.com:9000'; + const nextConfig = { env: { - API_BASE: 'http://ctf.b01lers.com:9000/api/v1', + API_BASE: `${RCTF_BASE}/api/v1`, KLODD_URL: 'https://klodd.localhost.direct' - } + }, + // ... } ``` Then, run @@ -47,7 +50,7 @@ RCTF_GIT_REF=master You can then start both the rCTF backend and production frontend instance simultaneously with ```bash -docker-compose up -d --build +docker compose up -d --build ``` ### Configuring diff --git a/next.config.js b/next.config.js index ea81c46..e27721a 100644 --- a/next.config.js +++ b/next.config.js @@ -1,7 +1,9 @@ +const RCTF_BASE = 'http://ctf.b01lers.com:9002'; + /** @type {import('next').NextConfig} */ const nextConfig = { env: { - API_BASE: 'http://ctf.b01lers.com:9002/api/v1', + API_BASE: `${RCTF_BASE}/api/v1`, KLODD_URL: 'https://instancer.b01lersc.tf' }, logging: { @@ -15,6 +17,10 @@ const nextConfig = { { source: '/api/v1/:path*', destination: `${this.env.API_BASE}/:path*` + }, + { + source: '/uploads', + destination: `${RCTF_BASE}/uploads`, } ] }