Improved build script to allow for defining a custom domain for the webapp to use.
This commit is contained in:
parent
2f7e3ec20c
commit
f090e105dd
|
@ -11,33 +11,53 @@
|
||||||
module build_system;
|
module build_system;
|
||||||
|
|
||||||
import dsh;
|
import dsh;
|
||||||
|
import std.stdio;
|
||||||
|
import std.string;
|
||||||
|
|
||||||
const DIST = "./src/main/resources/app";
|
const DIST = "./src/main/resources/app";
|
||||||
const DIST_ORIGIN = "./quasar-app/dist/spa";
|
const DIST_ORIGIN = "./quasar-app/dist/spa";
|
||||||
const APP_BUILD = "quasar build -m spa";
|
const APP_BUILD = "quasar build -m spa";
|
||||||
|
const API_BUILD = "mvn clean package spring-boot:repackage -DskipTests=true";
|
||||||
|
|
||||||
void main(string[] args) {
|
void main(string[] args) {
|
||||||
print("Building RailSignalAPI");
|
print("Building RailSignalAPI");
|
||||||
|
string baseDomain = "localhost:8080";
|
||||||
|
bool useHttps = false;
|
||||||
|
if (args.length >= 2) {
|
||||||
|
baseDomain = args[1];
|
||||||
|
if (args.length >= 3 && args[2] == "secure") {
|
||||||
|
useHttps = true;
|
||||||
|
print("Will configure web app to use secure connections.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string apiUrl = format!"%s://%s/api"(useHttps ? "https" : "http", baseDomain);
|
||||||
|
string wsUrl = format!"%s://%s/api/ws/app"(useHttps ? "wss" : "ws", baseDomain);
|
||||||
|
print("Building web app using API url %s and WS url %s", apiUrl, wsUrl);
|
||||||
|
sleepSeconds(3);
|
||||||
|
|
||||||
chdir("quasar-app");
|
chdir("quasar-app");
|
||||||
print("Building app...");
|
print("Building app...");
|
||||||
|
setEnv("RAIL_SIGNAL_API_URL", apiUrl);
|
||||||
|
setEnv("RAIL_SIGNAL_WS_URL", wsUrl);
|
||||||
runOrQuit(APP_BUILD);
|
runOrQuit(APP_BUILD);
|
||||||
print("Copying dist from %s to %s", DIST_ORIGIN, DIST);
|
print("Copying dist from %s to %s", DIST_ORIGIN, DIST);
|
||||||
chdir("..");
|
chdir("..");
|
||||||
removeIfExists(DIST);
|
removeIfExists(DIST);
|
||||||
mkdir(DIST);
|
mkdir(DIST);
|
||||||
copyDir(DIST_ORIGIN, DIST);
|
copyDir(DIST_ORIGIN, DIST);
|
||||||
print("Building API...");
|
|
||||||
runOrQuit("mvn clean package spring-boot:repackage -DskipTests=true");
|
|
||||||
print("Build complete!");
|
|
||||||
|
|
||||||
if (args.length > 1 && args[1] == "run") {
|
print("Building API...");
|
||||||
string f = findFile("target", "^.+\\.jar$", false);
|
runOrQuit(API_BUILD);
|
||||||
if (f == null) {
|
print("Build complete!");
|
||||||
error("Could not find jar file!");
|
string jarFile = findFile(".", "\\.jar", false);
|
||||||
} else {
|
|
||||||
print("Running the program.");
|
print("Generating run script...");
|
||||||
run("java -jar " ~ f);
|
auto scriptFile = File("target/run.sh", "w");
|
||||||
}
|
scriptFile.write("#!/usr/bin/bash\n");
|
||||||
}
|
scriptFile.write("RAIL_SIGNAL_API_URL=http://localhost:8080/api\n");
|
||||||
|
scriptFile.write("RAIL_SIGNAL_WS_URL=ws://localhost:8080/api/ws/app\n");
|
||||||
|
scriptFile.write("java -jar " ~ jarFile ~ "\n");
|
||||||
|
scriptFile.close();
|
||||||
|
print("Script file generated.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,8 +71,8 @@ module.exports = configure(function (ctx) {
|
||||||
publicPath: "/app/",
|
publicPath: "/app/",
|
||||||
// analyze: true,
|
// analyze: true,
|
||||||
env: {
|
env: {
|
||||||
API_URL: ctx.dev ? "http://localhost:8080/api" : "http://localhost:8080/api",
|
API_URL: ctx.dev ? "http://localhost:8080/api" : process.env.RAIL_SIGNAL_API_URL,
|
||||||
WS_URL: ctx.dev ? "ws://localhost:8080/api/ws/app" : "ws://localhost:8080/api/ws/app"
|
WS_URL: ctx.dev ? "ws://localhost:8080/api/ws/app" : process.env.RAIL_SIGNAL_WS_URL
|
||||||
},
|
},
|
||||||
// rawDefine: {}
|
// rawDefine: {}
|
||||||
// ignorePublicFolder: true,
|
// ignorePublicFolder: true,
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
export const API_URL = process.env.API_URL;
|
export const API_URL = process.env.API_URL;
|
||||||
export const WS_URL = process.env.WS_URL;
|
export const WS_URL = process.env.WS_URL;
|
||||||
|
console.log("Using API url: " + API_URL);
|
||||||
|
console.log("Using WS url: " + WS_URL);
|
||||||
|
|
|
@ -99,8 +99,6 @@
|
||||||
dense
|
dense
|
||||||
size="sm"
|
size="sm"
|
||||||
:label="node.name"
|
:label="node.name"
|
||||||
:color="component.activeConfiguration && component.activeConfiguration.id === config.id ? 'primary' : 'secondary'"
|
|
||||||
:text-color="'white'"
|
|
||||||
clickable
|
clickable
|
||||||
@click="select(node)"
|
@click="select(node)"
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue