const path = require("path");

const port = Number(process.env.PORT || 3000);
const staticDir = path.join(__dirname, "..", "..", "dist", "frontend");
const maxUploadBytes = Number(process.env.MAX_UPLOAD_BYTES || 15 * 1024 * 1024 * 1024);
const streamThresholdBytes = Number(process.env.UPLOAD_STREAM_THRESHOLD_BYTES || 64 * 1024 * 1024);

const jwtSecret = process.env.JWT_SECRET || "dev-secret-change-me";
const jwtExpiresIn = process.env.JWT_EXPIRES_IN || "15m";
const jwtRefreshExpiresIn = process.env.JWT_REFRESH_EXPIRES_IN || "24h";

const metadataIndex = process.env.ELASTICSEARCH_INDEX || "file-metadata";
const storageBucket = process.env.S3_BUCKET || "user-files";
const elasticsearchUrl = process.env.ELASTICSEARCH_URL || "http://localhost:9200";
const s3EndpointRaw = process.env.S3_ENDPOINT || "http://localhost:9000";

module.exports = {
  port,
  staticDir,
  maxUploadBytes,
  streamThresholdBytes,
  jwtSecret,
  jwtExpiresIn,
  jwtRefreshExpiresIn,
  metadataIndex,
  storageBucket,
  elasticsearchUrl,
  s3EndpointRaw
};
