- Updated documentation to include new API server details and configuration options. - Enhanced `SubmitBugReport` method to attempt server upload and handle errors gracefully. - Added `UploadBugReport` method to handle multipart file uploads to the API server. - Introduced new API server with MySQL backend for managing bug reports. - Implemented rate limiting and authentication for the API. - Created database schema and migration scripts for bug report storage. - Added admin routes for managing bug reports and files. - Updated frontend to reflect changes in bug report submission and success/error messages.
25 lines
872 B
TypeScript
25 lines
872 B
TypeScript
export const config = {
|
|
mysql: {
|
|
host: process.env.MYSQL_HOST || "localhost",
|
|
port: parseInt(process.env.MYSQL_PORT || "3306"),
|
|
user: process.env.MYSQL_USER || "emly",
|
|
password: process.env.MYSQL_PASSWORD || "",
|
|
database: process.env.MYSQL_DATABASE || "emly_bugreports",
|
|
},
|
|
apiKey: process.env.API_KEY || "",
|
|
adminKey: process.env.ADMIN_KEY || "",
|
|
port: parseInt(process.env.PORT || "3000"),
|
|
rateLimit: {
|
|
max: parseInt(process.env.RATE_LIMIT_MAX || "5"),
|
|
windowHours: parseInt(process.env.RATE_LIMIT_WINDOW_HOURS || "24"),
|
|
},
|
|
} as const;
|
|
|
|
// Validate required config on startup
|
|
export function validateConfig(): void {
|
|
if (!config.apiKey) throw new Error("API_KEY is required");
|
|
if (!config.adminKey) throw new Error("ADMIN_KEY is required");
|
|
if (!config.mysql.password)
|
|
throw new Error("MYSQL_PASSWORD is required");
|
|
}
|