Coalesce quota refreshes and consolidate shared helpers
Some checks failed
Deploy Sokko G / deploy (push) Failing after 2s
Some checks failed
Deploy Sokko G / deploy (push) Failing after 2s
This commit is contained in:
parent
a4cf633ab4
commit
748415082b
19 changed files with 216 additions and 64 deletions
|
|
@ -1,24 +1,9 @@
|
|||
// Rôle : configure Vite et charge les variables locales communes au serveur.
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { loadProjectEnv } from "./scripts/load-project-env.mjs";
|
||||
|
||||
function loadEnvFile(file = ".env") {
|
||||
if (!existsSync(file)) return;
|
||||
|
||||
readFileSync(file, "utf8").split(/\r?\n/).forEach((line) => {
|
||||
const trimmed = line.trim();
|
||||
if (!trimmed || trimmed.startsWith("#")) return;
|
||||
|
||||
const separatorIndex = trimmed.indexOf("=");
|
||||
if (separatorIndex < 1) return;
|
||||
|
||||
const key = trimmed.slice(0, separatorIndex).trim();
|
||||
const value = trimmed.slice(separatorIndex + 1).trim().replace(/^["']|["']$/g, "");
|
||||
if (!process.env[key]) process.env[key] = value;
|
||||
});
|
||||
}
|
||||
|
||||
loadEnvFile();
|
||||
loadProjectEnv();
|
||||
|
||||
export default defineConfig({
|
||||
root: "website",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue