mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 13:11:02 +00:00
feat(api): add local repl console
Based on the REPL from NestJS 9
This commit is contained in:
parent
99cc06bbbc
commit
0a9956e1ae
3 changed files with 41 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
version: "3.4"
|
||||
version: "3.9"
|
||||
|
||||
# Required for promtail scraping
|
||||
x-logging: &default-logging
|
||||
|
|
@ -84,6 +84,34 @@ services:
|
|||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
|
||||
|
||||
console:
|
||||
profiles:
|
||||
- console
|
||||
build:
|
||||
context: .
|
||||
target: build-api
|
||||
command: ["npm", "run", "start:console"]
|
||||
stdin_open: true
|
||||
tty: true
|
||||
environment:
|
||||
DB_HOST: db
|
||||
DB_USERNAME: listory
|
||||
DB_PASSWORD: listory
|
||||
DB_DATABASE: listory
|
||||
JWT_SECRET: listory
|
||||
APP_URL: "http://localhost:3000"
|
||||
NODE_ENV: local # pretty logs
|
||||
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: http://tempo:4318/v1/traces
|
||||
env_file: .env
|
||||
volumes:
|
||||
- ./src:/app/src
|
||||
ports:
|
||||
- "9464:9464" # Metrics
|
||||
networks:
|
||||
- db
|
||||
logging: *default-logging
|
||||
|
||||
networks:
|
||||
db: {}
|
||||
web: {}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
"format": "prettier --write \"src/**/*.ts\"",
|
||||
"start": "nest start",
|
||||
"start:dev": "nest start --watch",
|
||||
"start:console": "nest start --watch --entryFile console",
|
||||
"start:debug": "nest start --debug --watch",
|
||||
"start:prod": "node dist/main",
|
||||
"lint": "eslint --ext .js,.jsx,.ts,.tsx src/ frontend/src/",
|
||||
|
|
|
|||
11
src/console.ts
Normal file
11
src/console.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { repl } from "@nestjs/core";
|
||||
import { AppModule } from "./app.module";
|
||||
import { otelSDK } from "./open-telemetry/sdk";
|
||||
|
||||
async function bootstrap() {
|
||||
await otelSDK.start();
|
||||
|
||||
// TODO: Disable scheduled tasks from SourcesModule when in repl mode
|
||||
await repl(AppModule);
|
||||
}
|
||||
bootstrap();
|
||||
Loading…
Add table
Add a link
Reference in a new issue