返回提交历史
Modified
.github/workflows/build.yml
+0
-1
Modified
docker-entrypoint.sh
+0
-6
Modified
src/services/buildConfigService.ts
+13
-5
XFEstudio/XFESpaceNinjaServer
chore: make buildConfig.json optional (#822)
15f36263
代码差异
3 个文件
+13
-12
@@ -17,6 +17,5 @@ jobs:
17
17
node-version: ${{ matrix.version }}
18
18
- run: npm ci
19
19
- run: cp config.json.example config.json
20
- run: echo '{"version":"","buildLabel":"","matchmakingBuildId":""}' > static/data/buildConfig.json
21
20
- run: npm run build
22
21
- run: npm run lint
@@ -19,11 +19,5 @@ do
19
19
mv config.tmp config.json
20
20
done
21
21
22
if [ ! -f "/app/static/data/buildConfig.json" ]
23
then
24
echo "buildConfig not found, refusing to start."
25
exit 1
26
fi
27
28
22
npm install
29
23
exec npm run dev
@@ -1,13 +1,21 @@
1
1
import path from "path";
2
2
import fs from "fs";
3
3
4
const rootDir = path.join(__dirname, "../..");
5
const repoDir = path.basename(rootDir) == "build" ? path.join(rootDir, "..") : rootDir;
6
const buildConfigPath = path.join(repoDir, "static/data/buildConfig.json");
7
export const buildConfig = JSON.parse(fs.readFileSync(buildConfigPath, "utf-8")) as IBuildConfig;
8
9
4
interface IBuildConfig {
10
5
version: string;
11
6
buildLabel: string;
12
7
matchmakingBuildId: string;
13
8
}
9
10
export const buildConfig: IBuildConfig = {
11
version: "",
12
buildLabel: "",
13
matchmakingBuildId: ""
14
};
15
16
const rootDir = path.join(__dirname, "../..");
17
const repoDir = path.basename(rootDir) == "build" ? path.join(rootDir, "..") : rootDir;
18
const buildConfigPath = path.join(repoDir, "static/data/buildConfig.json");
19
if (fs.existsSync(buildConfigPath)) {
20
Object.assign(buildConfig, JSON.parse(fs.readFileSync(buildConfigPath, "utf-8")) as IBuildConfig);
21
}