package fr.monkhanny.dorfromantik.utils; import java.io.*; import java.util.*; public class Environnement { private static final String ENV_FILE = ".env"; private static final Properties properties = new Properties(); static { loadEnvironmentVariables(); } private static void loadEnvironmentVariables() { try (InputStream input = new FileInputStream(ENV_FILE)) { // Chargement des variables du fichier .env properties.load(input); } catch (IOException e) { System.err.println("Erreur lors du chargement du fichier .env : " + e.getMessage()); } } // Méthode pour récupérer une variable d'environnement, renvoie null si non trouvé public static String getEnv(String key) { return properties.getProperty(key); } // Méthode pour vérifier si une variable d'environnement est présente public static boolean hasEnv(String key) { return properties.containsKey(key); } }