Add custom logo URL configuration option
Bug: https://github.com/happyDomain/happydeliver/issues/6
This commit is contained in:
parent
64ba6932f7
commit
8a10eef2f5
5 changed files with 14 additions and 2 deletions
|
|
@ -41,6 +41,7 @@ func declareFlags(o *Config) {
|
|||
flag.DurationVar(&o.ReportRetention, "report-retention", o.ReportRetention, "How long to keep reports (e.g., 720h, 30d). 0 = keep forever")
|
||||
flag.UintVar(&o.RateLimit, "rate-limit", o.RateLimit, "API rate limit (requests per second per IP)")
|
||||
flag.Var(&URL{&o.SurveyURL}, "survey-url", "URL for user feedback survey")
|
||||
flag.StringVar(&o.CustomLogoURL, "custom-logo-url", o.CustomLogoURL, "URL for custom logo image in the web UI")
|
||||
|
||||
// Others flags are declared in some other files likes sources, storages, ... when they need specials configurations
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ type Config struct {
|
|||
ReportRetention time.Duration // How long to keep reports. 0 = keep forever
|
||||
RateLimit uint // API rate limit (requests per second per IP)
|
||||
SurveyURL url.URL // URL for user feedback survey
|
||||
CustomLogoURL string // URL for custom logo image in the web UI
|
||||
}
|
||||
|
||||
// DatabaseConfig contains database connection settings
|
||||
|
|
|
|||
|
|
@ -66,6 +66,10 @@ func DeclareRoutes(cfg *config.Config, router *gin.Engine) {
|
|||
appConfig["rbls"] = cfg.Analysis.RBLs
|
||||
}
|
||||
|
||||
if cfg.CustomLogoURL != "" {
|
||||
appConfig["custom_logo_url"] = cfg.CustomLogoURL
|
||||
}
|
||||
|
||||
if appcfg, err := json.MarshalIndent(appConfig, "", " "); err != nil {
|
||||
log.Println("Unable to generate JSON config to inject in web application")
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import { writable } from "svelte/store";
|
|||
interface AppConfig {
|
||||
report_retention?: number;
|
||||
survey_url?: string;
|
||||
custom_logo_url?: string;
|
||||
}
|
||||
|
||||
const defaultConfig: AppConfig = {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
import favicon from "$lib/assets/favicon.svg";
|
||||
|
||||
import Logo from "$lib/components/Logo.svelte";
|
||||
import { appConfig } from "$lib/stores/config";
|
||||
import { theme } from "$lib/stores/theme";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
|
|
@ -32,8 +33,12 @@
|
|||
<nav class="navbar navbar-expand-lg navbar-light shadow-sm">
|
||||
<div class="container">
|
||||
<a class="navbar-brand fw-bold" href="/">
|
||||
<i class="bi bi-envelope-check me-2"></i>
|
||||
<Logo color={$theme === "light" ? "black" : "white"} />
|
||||
{#if $appConfig.custom_logo_url}
|
||||
<img src={$appConfig.custom_logo_url} alt="Logo" style="height: 25px;" />
|
||||
{:else}
|
||||
<i class="bi bi-envelope-check me-2"></i>
|
||||
<Logo color={$theme === "light" ? "black" : "white"} />
|
||||
{/if}
|
||||
</a>
|
||||
<div>
|
||||
<span class="d-none d-md-inline navbar-text text-primary small">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue