Allow to override the banner with its existing env variable

This commit is contained in:
Jan Böhmer 2025-08-24 17:37:16 +02:00
parent ae08d9539d
commit ac89489202
6 changed files with 13 additions and 22 deletions

4
.env
View file

@ -129,10 +129,6 @@ NO_URL_REWRITE_AVAILABLE=0
# Set to 1, if Part-DB should redirect all HTTP requests to HTTPS. You dont need to configure this, if your webserver already does this. # Set to 1, if Part-DB should redirect all HTTP requests to HTTPS. You dont need to configure this, if your webserver already does this.
REDIRECT_TO_HTTPS=0 REDIRECT_TO_HTTPS=0
# Override value if you want to show to show a given text on homepage.
# When this is empty the content of config/banner.md is used as banner
BANNER=""
# Set this to zero, if you want to disable the year 2038 bug check on 32-bit systems (it will cause errors with current 32-bit PHP versions) # Set this to zero, if you want to disable the year 2038 bug check on 32-bit systems (it will cause errors with current 32-bit PHP versions)
DISABLE_YEAR2038_BUG_CHECK=0 DISABLE_YEAR2038_BUG_CHECK=0

View file

@ -1,14 +1,4 @@
Welcome to Part-DB. **Attention**:
Since Version 2.0.0 this file is no longer used.
<small>If you want to change this banner, edit `config/banner.md` file or set the `BANNER` environment variable.</small> You can now set the banner text directly in the admin interface, or by setting the `BANNER` environment variable.
<blockquote class="pb-0">
<p style="font-size: 12px">
And God said <br>
$\nabla \cdot \vec{D} = \rho$,
$\nabla \cdot \vec{B} = 0$,
$\nabla \times \vec{E} = -\frac{\partial \vec{B}}{\partial t}$,
$\nabla \times \vec{H} = \vec{j} + \frac{\partial \vec{D}}{\partial t}$, <br>
and then there was light.
</p>
</blockquote>

View file

@ -90,7 +90,6 @@ parameters:
env(ERROR_PAGE_SHOW_HELP): 1 env(ERROR_PAGE_SHOW_HELP): 1
env(DEMO_MODE): 0 env(DEMO_MODE): 0
env(BANNER): ''
env(EMAIL_SENDER_EMAIL): 'noreply@partdb.changeme' env(EMAIL_SENDER_EMAIL): 'noreply@partdb.changeme'

View file

@ -24,4 +24,9 @@ easily upgrade your system to the new requirements. Otherwise, you can use the o
ships all required dependencies and is always up to date with the latest requirements, so that you do not have to worry ships all required dependencies and is always up to date with the latest requirements, so that you do not have to worry
about the requirements at all. about the requirements at all.
## Changes
* The `config/banner.md` file that could been used to customize the banner text, was removed. You can now set the banner text
directly in the admin interface, or by setting the `BANNER` environment variable. If you want to keep your existing
banner text, you will have to copy it from the `config/banner.md` file to the admin interface or set the `BANNER`
environment variable.

View file

@ -30,7 +30,7 @@ use App\Settings\SystemSettings\CustomizationSettings;
*/ */
class BannerHelper class BannerHelper
{ {
public function __construct(private CustomizationSettings $customizationSettings) public function __construct(private readonly CustomizationSettings $customizationSettings)
{ {
} }

View file

@ -49,6 +49,7 @@ class CustomizationSettings
#[SettingsParameter( #[SettingsParameter(
label: new TM("settings.system.customization.banner"), label: new TM("settings.system.customization.banner"),
formType: RichTextEditorType::class, formOptions: ['mode' => 'markdown-full'], formType: RichTextEditorType::class, formOptions: ['mode' => 'markdown-full'],
envVar: "BANNER", envVarMode: EnvVarMode::OVERWRITE,
)] )]
public ?string $banner = null; public ?string $banner = null;