feat: restructure backend with Elysia framework and add MQTT adapter
- Updated .gitignore to exclude generated files and database - Modified package.json to change dev script and add new dependencies - Removed src/index.ts and created app.ts for Elysia server initialization - Added environment variable configuration in config/env.ts - Implemented MQTT adapter in adapter/mqtt.ts for message handling - Created Prisma client in prisma/client.ts and defined schema in prisma/schema.prisma - Added seeding script in prisma/seed.ts for measurement points - Established logging utility in utils/logger.ts for structured logging - Created bed router in routes/bed.ts for handling bed-related routes
This commit is contained in:
parent
b76d6b99ee
commit
a767dc3635
14 changed files with 801 additions and 14 deletions
58
config/env.ts
Normal file
58
config/env.ts
Normal file
|
@ -0,0 +1,58 @@
|
|||
import { cleanEnv, str, bool, port, url, host } from "envalid";
|
||||
|
||||
const env = cleanEnv(process.env, {
|
||||
BACKEND_PORT: port({
|
||||
desc: "The port for the backend server",
|
||||
default: 3000,
|
||||
}),
|
||||
|
||||
DATABASE_URL: url({
|
||||
desc: "The URL for the database connection",
|
||||
}),
|
||||
|
||||
// Redis configuration
|
||||
REDIS_HOST: host({
|
||||
desc: "The host for the Redis server",
|
||||
default: "localhost",
|
||||
}),
|
||||
REDIS_PORT: port({
|
||||
desc: "The port for the Redis server",
|
||||
default: 6379,
|
||||
}),
|
||||
REDIS_PASSWORD: str({
|
||||
desc: "The password for the Redis server",
|
||||
}),
|
||||
|
||||
// S3 configuration
|
||||
S3_ENDPOINT: host({
|
||||
desc: "The endpoint for the S3 service",
|
||||
default: "localhost",
|
||||
}),
|
||||
S3_BUCKET: str({
|
||||
desc: "The name of the S3 bucket",
|
||||
default: "my-bucket",
|
||||
}),
|
||||
S3_PORT: port({
|
||||
desc: "The port for the S3 service",
|
||||
default: 9000,
|
||||
}),
|
||||
S3_USE_SSL: bool({
|
||||
desc: "Use SSL for S3 service",
|
||||
default: false,
|
||||
}),
|
||||
S3_ACCESS_KEY: str({
|
||||
desc: "Access key for the S3 service",
|
||||
}),
|
||||
S3_SECRET_KEY: str({
|
||||
desc: "Secret key for the S3 service",
|
||||
}),
|
||||
|
||||
// Log Level configuration
|
||||
LOG_LEVEL: str({
|
||||
desc: "The log level for the application",
|
||||
choices: ["debug", "info", "warn", "error", "silent"],
|
||||
default: "info",
|
||||
}),
|
||||
});
|
||||
|
||||
export default env;
|
Loading…
Add table
Add a link
Reference in a new issue