diff --git a/Makefile b/Makefile index 41b39142..f726cddb 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ build: ## Build the Gotenberg's Docker image -t $(DOCKER_REGISTRY)/$(DOCKER_REPOSITORY):$(GOTENBERG_VERSION) \ -f $(DOCKERFILE) $(DOCKER_BUILD_CONTEXT) +GOTENBERG_HIDE_BANNER=false GOTENBERG_GRACEFUL_SHUTDOWN_DURATION=30s GOTENBERG_BUILD_DEBUG_DATA=true API_PORT=3000 @@ -85,6 +86,7 @@ run: ## Start a Gotenberg container -e GOTENBERG_API_BASIC_AUTH_PASSWORD=$(GOTENBERG_API_BASIC_AUTH_PASSWORD) \ $(DOCKER_REGISTRY)/$(DOCKER_REPOSITORY):$(GOTENBERG_VERSION) \ gotenberg \ + --gotenberg-hide-banner=$(GOTENBERG_HIDE_BANNER) \ --gotenberg-graceful-shutdown-duration=$(GOTENBERG_GRACEFUL_SHUTDOWN_DURATION) \ --gotenberg-build-debug-data="$(GOTENBERG_BUILD_DEBUG_DATA)" \ --api-port=$(API_PORT) \ diff --git a/cmd/gotenberg.go b/cmd/gotenberg.go index 8e558064..c7bc3a13 100644 --- a/cmd/gotenberg.go +++ b/cmd/gotenberg.go @@ -36,11 +36,11 @@ var Version = "snapshot" // Run starts the Gotenberg application. Call this in the main of your program. func Run() { - fmt.Printf(banner, Version) gotenberg.Version = Version // Create the root FlagSet and adds the modules flags to it. 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.Bool("gotenberg-build-debug-data", true, "Set if build data is needed") @@ -51,8 +51,6 @@ func Run() { modsInfo += desc.ID + " " } - fmt.Printf("[SYSTEM] modules: %s\n", modsInfo) - // Parse the flags. err := fs.Parse(os.Args[1:]) if err != nil { @@ -90,10 +88,14 @@ func Run() { // Create a wrapper around our flags. parsedFlags := gotenberg.ParsedFlags{FlagSet: fs} - - // Get the graceful shutdown duration. + hideBanner := parsedFlags.MustBool("gotenberg-hide-banner") 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) // Start application modules.