Version bump, and cleaned up some frontend.
This commit is contained in:
parent
9cb074b2ec
commit
2561c8f3d4
|
@ -21,24 +21,8 @@ const API_BUILD = "mvn clean package spring-boot:repackage -DskipTests=true";
|
|||
|
||||
void main(string[] args) {
|
||||
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");
|
||||
print("Building app...");
|
||||
setEnv("RAIL_SIGNAL_API_URL", apiUrl);
|
||||
setEnv("RAIL_SIGNAL_WS_URL", wsUrl);
|
||||
runOrQuit(APP_BUILD);
|
||||
print("Copying dist from %s to %s", DIST_ORIGIN, DIST);
|
||||
chdir("..");
|
||||
|
@ -49,15 +33,5 @@ void main(string[] args) {
|
|||
print("Building API...");
|
||||
runOrQuit(API_BUILD);
|
||||
print("Build complete!");
|
||||
string jarFile = findFile(".", "\\.jar", false);
|
||||
|
||||
print("Generating run script...");
|
||||
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.");
|
||||
}
|
||||
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
|||
</parent>
|
||||
<groupId>nl.andrewl</groupId>
|
||||
<artifactId>rail-signal-api</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<version>2.0.1</version>
|
||||
<name>rail-signal-api</name>
|
||||
<description>A simple API for tracking rail traffic in signalled blocks.</description>
|
||||
<properties>
|
||||
|
|
|
@ -70,10 +70,10 @@ module.exports = configure(function (ctx) {
|
|||
|
||||
publicPath: "/app/",
|
||||
// analyze: true,
|
||||
env: {
|
||||
API_URL: ctx.dev ? "http://localhost:8080/api" : process.env.RAIL_SIGNAL_API_URL,
|
||||
WS_URL: ctx.dev ? "ws://localhost:8080/api/ws/app" : process.env.RAIL_SIGNAL_WS_URL
|
||||
},
|
||||
// env: {
|
||||
// API_URL: ctx.dev ? "http://localhost:8080/api" : process.env.RAIL_SIGNAL_API_URL,
|
||||
// WS_URL: ctx.dev ? "ws://localhost:8080/api/ws/app" : process.env.RAIL_SIGNAL_WS_URL
|
||||
// },
|
||||
// rawDefine: {}
|
||||
// ignorePublicFolder: true,
|
||||
// minify: "hidden",
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
export const API_URL = process.env.API_URL;
|
||||
export const WS_URL = process.env.WS_URL;
|
||||
console.log("Using API url: " + API_URL);
|
||||
console.log("Using WS url: " + WS_URL);
|
||||
/*
|
||||
In development mode, we should use localhost:8080 as that's where the API is set
|
||||
to run. In production mode, this app is deployed under the same host as the API,
|
||||
so we can simply use `location.origin` and `location.host` to define our API and
|
||||
WS urls.
|
||||
*/
|
||||
export const API_URL = process.env.DEV
|
||||
? "http://localhost:8080/api"
|
||||
: location.origin + "/api";
|
||||
export const WS_URL = process.env.DEV
|
||||
? "ws://localhost:8080/api/ws/app"
|
||||
: (location.protocol === "https:" ? "wss://" : "ws://") + location.host + "/api/ws/app";
|
||||
|
|
|
@ -33,6 +33,7 @@ public class WebsocketConfig implements WebSocketConfigurer {
|
|||
.addInterceptors(componentInterceptor);
|
||||
WebSocketHandlerRegistration appHandlerReg = registry.addHandler(appHandler, "/api/ws/app/*")
|
||||
.addInterceptors(appInterceptor);
|
||||
// appHandlerReg.setAllowedOrigins("*");
|
||||
// If we're in a development profile, allow any origin to access the app websocket.
|
||||
// This is so that we can use a standalone JS dev server.
|
||||
if (Set.of(env.getActiveProfiles()).contains("development")) {
|
||||
|
|
Loading…
Reference in New Issue