config.php 798 B

123456789101112131415161718192021222324252627
  1. <?php
  2. define("ENVIRONMENT", getenv("ENVIRONMENT") ?? "production");
  3. define("ROOT_PATH", dirname(__FILE__));
  4. define("SYSTEM_PATH", "/var/daktylos");
  5. define("LOG_PATH", SYSTEM_PATH . '/logs/');
  6. define("DATA_PATH", SYSTEM_PATH . '/data/');
  7. define("DBNAME", "daktylos-".ENVIRONMENT.".sqlite3");
  8. function daktylos_autoload($classname){
  9. require_once ROOT_PATH . "/libs/" . $classname . ".class.php";
  10. }
  11. spl_autoload_register("daktylos_autoload");
  12. $sessionId = $_POST['auth_token'] ?? $_GET['auth_token'] ?? null;
  13. if(!empty($sessionId)) {
  14. session_id($sessionId);
  15. }
  16. session_start();
  17. $_SESSION['last_access'] = time(); //session write access to prevent timeout
  18. define("DOMAIN",explode(".", strtolower($_SERVER['HTTP_HOST']))[0]);
  19. define("CACHEBUST", 4);
  20. include_once("config.".ENVIRONMENT.".php");