8 Commits

Author SHA1 Message Date
d8432315d5 Merge branch 'release/v1.1.0'
All checks were successful
continuous-integration/drone/push Build is passing
2023-04-15 17:02:57 +02:00
7cd8ea9d50 bump version to 1.1.0 2023-04-15 17:02:40 +02:00
Fionn
80c961da81 Merge pull request #1 from MorpheusXAUT/configurable-base-path
Configurable base API path
2023-04-15 17:00:04 +02:00
Nick 'MorpheusXAUT' Müller
79e559a723 Fix Docker image URL in README 2023-03-25 17:34:37 +01:00
Nick 'MorpheusXAUT' Müller
80a354b456 Fix node_modules exclusion in dockerignore 2023-03-25 17:23:45 +01:00
Nick 'MorpheusXAUT' Müller
407f817c8d Add interrupt signal handling for graceful server shutdown 2023-03-25 17:23:15 +01:00
Nick 'MorpheusXAUT' Müller
759e4c3711 Make base API path configurable via env variable 2023-03-25 17:20:33 +01:00
131acbf75c Merge tag 'v1.0.0' into develop 2023-03-11 15:16:51 +01:00
4 changed files with 22 additions and 6 deletions

View File

@@ -1,2 +1,2 @@
.git
node_modules
**/node_modules

View File

@@ -6,7 +6,7 @@ This service is designed to gather weather data to be used by [IASsure](https://
## Installation/Deployment
IASsure-WX can be installed using docker. The image is available at `git.fsisp.de/fionn/iassure`.
IASsure-WX can be installed using docker. The image is available at `git.fsisp.de/fionn/iassure-wx`.
Tags:
- `latest` - The newest recommended build, built from `main`

View File

@@ -1,6 +1,6 @@
{
"name": "app",
"version": "1.0.0",
"version": "1.1.0",
"description": "",
"main": "index.js",
"type": "module",

View File

@@ -4,14 +4,14 @@ import morgan from 'morgan';
import router from './router';
import wxService from './services/wx.service';
const { PORT = 3000 } = process.env;
const { PORT = 3000, BASE_PATH = '/api' } = process.env;
const app = express();
app.set('trust proxy', true);
app.use(morgan('combined'));
app.use('/api', router.router);
app.use(BASE_PATH, router.router);
const frontendRoot = '/opt/frontend/dist';
app.use(express.static(frontendRoot));
@@ -28,8 +28,24 @@ app.use((err, req: Request, res: Response, next: NextFunction) => {
nodesched.scheduleJob('regenerate data', '*/30 * * * * *', wxService.wrappedGenerateData)
wxService.wrappedGenerateData();
app.listen(PORT, () => {
const server = app.listen(PORT, () => {
console.log(
`application is listening on port ${PORT}`,
);
});
const shutdown = (signal: string) => {
console.log(`${signal} signal received. Shutting down.`);
server.close((err) => {
if (err) {
console.error(`Failed to shut down server gracefully: ${err}`);
process.exit(1);
}
console.log('Server closed');
process.exit(0);
});
};
process.on('SIGTERM', () => shutdown('SIGTERM'));
process.on('SIGINT', () => shutdown('SIGINT'));