Added deploy script.

This commit is contained in:
Andrew Lalis 2022-05-08 18:42:12 +02:00
parent ba409985e5
commit 74cf5736f0
4 changed files with 18 additions and 2 deletions

View File

@ -0,0 +1 @@
VITE_API_URL=http://localhost:8080/api

View File

@ -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);
}

View File

@ -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/");
}

View File

@ -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());
}
}