Skip to content

Commit 7754f55

Browse files
committed
Run panel on live backend
1 parent d1a0b21 commit 7754f55

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

docs/index.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ A conscious choice was made to have the discord bot interact via the http endpoi
1919
the http api and ensure it's capable. It also means that they can be hosted and restarted separately.
2020

2121
## Running the projects in dev
22-
Use `./gradlew bootRun` to run the platform api and `./gradlew dev` to run BotFest. Panel uses `pnpm dev`.
22+
Use `./gradlew bootRun` to run the platform api and `./gradlew dev` to run BotFest.
2323
Platform api and panel will run without any configuration, whilst BotFest needs some setup (see [here](./botfest/about.md#dev-env)).
2424

25+
Panel can be started with `pnpm dev`. It tries to connect to the local backend by default but you can run it on the
26+
production backend using `DEV_SERVER_URL="https://platform.modfest.net" pnpm dev`
27+
2528
You can configure the port and address that the platform api will use in dev in the `gradle.properties` file. This
2629
file is used in all subprojects.
2730

panel/next.config.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import type { NextConfig } from "next";
22
import { PHASE_DEVELOPMENT_SERVER } from "next/constants"
33
import fs from 'node:fs/promises';
4+
import { env } from "node:process";
45

56
const withBundleAnalyzer = require('@next/bundle-analyzer')({
67
enabled: process.env.ANALYZE === 'true',
78
})
89

910
async function getDevUrl(): Promise<string> {
11+
if (env["DEV_SERVER_URL"]) {
12+
return env["DEV_SERVER_URL"];
13+
}
14+
1015
const gradlePropsPath = __dirname+"/../gradle.properties"
1116
const gradleProps = await fs.readFile(gradlePropsPath, {encoding: "utf-8"})
1217
var lines = gradleProps.split("\n")
@@ -20,17 +25,17 @@ async function getDevUrl(): Promise<string> {
2025
}
2126

2227
export default async function createConfig(phase: string): Promise<NextConfig> {
23-
var env = {}
28+
var env_vars = {}
2429
if (phase === PHASE_DEVELOPMENT_SERVER) {
25-
env = {
30+
env_vars = {
2631
"DEV_SERVER_URL": await getDevUrl(),
27-
...env
32+
...env_vars
2833
}
2934
}
3035

3136
return withBundleAnalyzer({
3237
output: "standalone",
33-
env: env,
38+
env: env_vars,
3439
// Enable source maps in prod
3540
productionBrowserSourceMaps: true,
3641
// TODO these shouldn't really be ignored

0 commit comments

Comments
 (0)