feat(misc): add --gotenberg-hide-banner flag

This commit is contained in:
Julien Neuhart
2025-08-15 07:36:47 +02:00
parent bee56cfd99
commit cb98b0c937
2 changed files with 9 additions and 5 deletions

View File

@@ -10,6 +10,7 @@ build: ## Build the Gotenberg's Docker image
-t $(DOCKER_REGISTRY)/$(DOCKER_REPOSITORY):$(GOTENBERG_VERSION) \ -t $(DOCKER_REGISTRY)/$(DOCKER_REPOSITORY):$(GOTENBERG_VERSION) \
-f $(DOCKERFILE) $(DOCKER_BUILD_CONTEXT) -f $(DOCKERFILE) $(DOCKER_BUILD_CONTEXT)
GOTENBERG_HIDE_BANNER=false
GOTENBERG_GRACEFUL_SHUTDOWN_DURATION=30s GOTENBERG_GRACEFUL_SHUTDOWN_DURATION=30s
GOTENBERG_BUILD_DEBUG_DATA=true GOTENBERG_BUILD_DEBUG_DATA=true
API_PORT=3000 API_PORT=3000
@@ -85,6 +86,7 @@ run: ## Start a Gotenberg container
-e GOTENBERG_API_BASIC_AUTH_PASSWORD=$(GOTENBERG_API_BASIC_AUTH_PASSWORD) \ -e GOTENBERG_API_BASIC_AUTH_PASSWORD=$(GOTENBERG_API_BASIC_AUTH_PASSWORD) \
$(DOCKER_REGISTRY)/$(DOCKER_REPOSITORY):$(GOTENBERG_VERSION) \ $(DOCKER_REGISTRY)/$(DOCKER_REPOSITORY):$(GOTENBERG_VERSION) \
gotenberg \ gotenberg \
--gotenberg-hide-banner=$(GOTENBERG_HIDE_BANNER) \
--gotenberg-graceful-shutdown-duration=$(GOTENBERG_GRACEFUL_SHUTDOWN_DURATION) \ --gotenberg-graceful-shutdown-duration=$(GOTENBERG_GRACEFUL_SHUTDOWN_DURATION) \
--gotenberg-build-debug-data="$(GOTENBERG_BUILD_DEBUG_DATA)" \ --gotenberg-build-debug-data="$(GOTENBERG_BUILD_DEBUG_DATA)" \
--api-port=$(API_PORT) \ --api-port=$(API_PORT) \

View File

@@ -36,11 +36,11 @@ var Version = "snapshot"
// Run starts the Gotenberg application. Call this in the main of your program. // Run starts the Gotenberg application. Call this in the main of your program.
func Run() { func Run() {
fmt.Printf(banner, Version)
gotenberg.Version = Version gotenberg.Version = Version
// Create the root FlagSet and adds the modules flags to it. // Create the root FlagSet and adds the modules flags to it.
fs := flag.NewFlagSet("gotenberg", flag.ExitOnError) fs := flag.NewFlagSet("gotenberg", flag.ExitOnError)
fs.Bool("gotenberg-hide-banner", false, "Hide the banner")
fs.Duration("gotenberg-graceful-shutdown-duration", time.Duration(30)*time.Second, "Set the graceful shutdown duration") fs.Duration("gotenberg-graceful-shutdown-duration", time.Duration(30)*time.Second, "Set the graceful shutdown duration")
fs.Bool("gotenberg-build-debug-data", true, "Set if build data is needed") fs.Bool("gotenberg-build-debug-data", true, "Set if build data is needed")
@@ -51,8 +51,6 @@ func Run() {
modsInfo += desc.ID + " " modsInfo += desc.ID + " "
} }
fmt.Printf("[SYSTEM] modules: %s\n", modsInfo)
// Parse the flags. // Parse the flags.
err := fs.Parse(os.Args[1:]) err := fs.Parse(os.Args[1:])
if err != nil { if err != nil {
@@ -90,10 +88,14 @@ func Run() {
// Create a wrapper around our flags. // Create a wrapper around our flags.
parsedFlags := gotenberg.ParsedFlags{FlagSet: fs} parsedFlags := gotenberg.ParsedFlags{FlagSet: fs}
hideBanner := parsedFlags.MustBool("gotenberg-hide-banner")
// Get the graceful shutdown duration.
gracefulShutdownDuration := parsedFlags.MustDuration("gotenberg-graceful-shutdown-duration") gracefulShutdownDuration := parsedFlags.MustDuration("gotenberg-graceful-shutdown-duration")
if !hideBanner {
fmt.Printf(banner, Version)
}
fmt.Printf("[SYSTEM] modules: %s\n", modsInfo)
ctx := gotenberg.NewContext(parsedFlags, descriptors) ctx := gotenberg.NewContext(parsedFlags, descriptors)
// Start application modules. // Start application modules.