- Added schema for users, licenses, and license hostnames in the database. - Created storage utility for reading and writing JSON files. - Developed user service for user registration, authentication, and retrieval. - Implemented authentication middleware to protect routes. - Built LicenseCard component to display license details. - Created SiteNav component for navigation with user authentication status. - Established AuthContext for managing authentication state and actions. - Developed Home page to display available plugins. - Created LicenseManager page for managing licenses with forms for creation and verification. - Implemented PluginDetail page to show detailed information about a specific plugin. - Added utility functions for date formatting.
30 lines
985 B
JavaScript
30 lines
985 B
JavaScript
import path from "path";
|
|
import { fileURLToPath } from "url";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
const serverDir = path.resolve(__dirname, "..");
|
|
const rootDir = path.resolve(serverDir, "..");
|
|
|
|
export const PATHS = {
|
|
serverDir,
|
|
rootDir,
|
|
distDir: path.join(rootDir, "dist"),
|
|
reposFile: path.join(serverDir, "repos.json")
|
|
};
|
|
|
|
export const PORT = process.env.PORT || 3001;
|
|
export const HOST = process.env.HOST || "::";
|
|
export const CACHE_TTL_MS = Number(process.env.CACHE_TTL_MS || 10 * 60 * 1000);
|
|
|
|
export const DB_CONFIG = {
|
|
host: process.env.DB_HOST || "127.0.0.1",
|
|
port: Number(process.env.DB_PORT || 3306),
|
|
user: process.env.DB_USER || "root",
|
|
password: process.env.DB_PASSWORD || "",
|
|
database: process.env.DB_NAME || "siti_plugin_repo"
|
|
};
|
|
|
|
export const JWT_SECRET = process.env.JWT_SECRET || "change-me-in-production";
|
|
export const JWT_EXPIRES_IN = process.env.JWT_EXPIRES_IN || "7d";
|