Portage complet PHP/Bash vers Node.js (Fastify + worker_threads)
This commit is contained in:
61
config.js
Normal file
61
config.js
Normal file
@@ -0,0 +1,61 @@
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { dirname, join } from 'node:path';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
export const ROOT = __dirname;
|
||||
export const TMDBINTEGRAL_DIR = join(ROOT, 'tmdbintegral');
|
||||
export const MOVIE_DIR = join(TMDBINTEGRAL_DIR, 'movie');
|
||||
export const TV_DIR = join(TMDBINTEGRAL_DIR, 'tv');
|
||||
export const JUSTWATCH_MOVIE_DIR = join(TMDBINTEGRAL_DIR, 'justwatchmovie');
|
||||
export const JUSTWATCH_TV_DIR = join(TMDBINTEGRAL_DIR, 'justwatchtv');
|
||||
export const IMDB_RATINGS = join(ROOT, 'imdbratings.tsv');
|
||||
export const CRON_TXT = join(ROOT, 'cron.txt');
|
||||
export const LASTCRON_TXT = join(ROOT, 'lastcron.txt');
|
||||
|
||||
function required(name) {
|
||||
const v = process.env[name];
|
||||
if (!v) throw new Error(`Variable d'environnement manquante: ${name} (voir .env.example)`);
|
||||
return v;
|
||||
}
|
||||
|
||||
function int(name, def) {
|
||||
const v = process.env[name];
|
||||
return v ? parseInt(v, 10) : def;
|
||||
}
|
||||
|
||||
function str(name, def) {
|
||||
return process.env[name] ?? def;
|
||||
}
|
||||
|
||||
// Secrets / runtime
|
||||
export const TMDB_API_KEY = required('TMDB_API_KEY');
|
||||
export const PASSWORD = required('PROXYTMDB_PASSWORD');
|
||||
export const SESSION_SECRET = required('SESSION_SECRET');
|
||||
export const PORT = int('PORT', 3000);
|
||||
export const HOST = str('HOST', '0.0.0.0');
|
||||
|
||||
// URLs externes
|
||||
export const TMDB_API_BASE = str('TMDB_API_BASE', 'https://api.themoviedb.org/3');
|
||||
export const TMDB_EXPORTS_BASE = str('TMDB_EXPORTS_BASE', 'http://files.tmdb.org/p/exports');
|
||||
export const IMDB_DATASETS_BASE = str('IMDB_DATASETS_BASE', 'https://datasets.imdbws.com');
|
||||
export const MOVIE_URL = str('MOVIE_URL', 'https://www.themoviedb.org/movie');
|
||||
export const TV_URL = str('TV_URL', 'https://www.themoviedb.org/tv');
|
||||
export const MOVIE_API_URL = str('MOVIE_API_URL', 'https://tmdb.uklm.xyz/api?t=movie&q=');
|
||||
export const TV_API_URL = str('TV_API_URL', 'https://tmdb.uklm.xyz/api?t=tv&q=');
|
||||
export const POSTER_URL = str('POSTER_URL', 'https://image.tmdb.org/t/p/w200');
|
||||
export const NO_POSTER_URL = str('NO_POSTER_URL', 'https://www.serveurperso.com/stats/noposter.jpg');
|
||||
export const IMDB_URL = str('IMDB_URL', 'https://www.imdb.com/title');
|
||||
|
||||
// Reglages cron / recherche
|
||||
export const CHANGES_DAYS = int('CHANGES_DAYS', 3);
|
||||
export const NB_SEARCH_PARTS = int('NB_SEARCH_PARTS', 8);
|
||||
export const NB_WORKERS = int('NB_WORKERS', 8);
|
||||
export const TITLE_TOLERANCE = int('TITLE_TOLERANCE', 40);
|
||||
export const LEV_INS = int('LEV_INS', 10);
|
||||
export const LEV_REP = int('LEV_REP', 12);
|
||||
export const LEV_DEL = int('LEV_DEL', 10);
|
||||
export const LEV_SCALE = int('LEV_SCALE', 10);
|
||||
export const YEAR_TOLERANCE = int('YEAR_TOLERANCE', 1);
|
||||
|
||||
export const TITLE = str('PAGE_TITLE', 'Index protégé');
|
||||
Reference in New Issue
Block a user