diff --git a/railsignal-app/.env.production b/railsignal-app/.env.production new file mode 100644 index 0000000..430da52 --- /dev/null +++ b/railsignal-app/.env.production @@ -0,0 +1 @@ +VITE_API_URL=http://localhost:8080/api \ No newline at end of file diff --git a/railsignal-app/deploy_to_spring.d b/railsignal-app/deploy_to_spring.d new file mode 100755 index 0000000..c8d43a9 --- /dev/null +++ b/railsignal-app/deploy_to_spring.d @@ -0,0 +1,15 @@ +#!/usr/bin/env dub +/+ dub.sdl: + dependency "dsh" version="~>1.6.1" ++/ +import dsh; + +const DEST = "../src/main/resources/static"; + +void main() { + print("Deploying Vue app to Spring's /static directory."); + runOrQuit("npm run build"); + rmdirRecurse(DEST); + copyDir("./dist", DEST); +} + diff --git a/src/main/java/nl/andrewl/railsignalapi/rest/WebConfig.java b/src/main/java/nl/andrewl/railsignalapi/rest/WebConfig.java index 22a3e05..4d55147 100644 --- a/src/main/java/nl/andrewl/railsignalapi/rest/WebConfig.java +++ b/src/main/java/nl/andrewl/railsignalapi/rest/WebConfig.java @@ -11,7 +11,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; public class WebConfig implements WebMvcConfigurer { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler("/static/**") + registry.addResourceHandler("/**") .addResourceLocations("classpath:/static/"); } diff --git a/src/main/java/nl/andrewl/railsignalapi/rest/dto/component/out/SwitchResponse.java b/src/main/java/nl/andrewl/railsignalapi/rest/dto/component/out/SwitchResponse.java index efb04a1..33ad8a9 100644 --- a/src/main/java/nl/andrewl/railsignalapi/rest/dto/component/out/SwitchResponse.java +++ b/src/main/java/nl/andrewl/railsignalapi/rest/dto/component/out/SwitchResponse.java @@ -11,6 +11,6 @@ public class SwitchResponse extends PathNodeResponse { public SwitchResponse(Switch s) { super(s); this.possibleConfigurations = s.getPossibleConfigurations().stream().map(SwitchConfigurationResponse::new).toList(); - this.activeConfiguration = new SwitchConfigurationResponse(s.getActiveConfiguration()); + this.activeConfiguration = s.getActiveConfiguration() == null ? null : new SwitchConfigurationResponse(s.getActiveConfiguration()); } }