From 2a3795bf932dd753c6e78872a4b2257aef91d593 Mon Sep 17 00:00:00 2001 From: Miraty Date: Wed, 10 Apr 2024 00:54:27 +0200 Subject: [PATCH] autopublish config.ini on /config.ini --- config.template.ini | 1 + router.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/config.template.ini b/config.template.ini index e001cc2..84d91a3 100644 --- a/config.template.ini +++ b/config.template.ini @@ -1,4 +1,5 @@ ; Directives here are described in https://servnest.niv.re/back/configuration +; When named config.ini, this file is served over HTTP as /config.php [common] public_domains[] = "servnest.test" diff --git a/router.php b/router.php index a53ef96..f6669c0 100644 --- a/router.php +++ b/router.php @@ -11,6 +11,12 @@ define('PAGE_ADDRESS', $pageAddress . ((substr($pageAddress, -1) === '/' OR $pag define('PAGE_LINEAGE', explode('/', PAGE_ADDRESS)); define('SERVICE', dirname(PAGE_ADDRESS)); +if (PAGE_ADDRESS === 'config.ini') { + header('Content-Type: text/plain'); + echo file_get_contents(ROOT_PATH . '/config.ini'); + exit(); +} + function pageNotFound(): never { http_response_code(404); exit(_('Page not found.'));