mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-19 05:32:16 +01:00
feat(misc): add --gotenberg-hide-banner flag
This commit is contained in:
2
Makefile
2
Makefile
@@ -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) \
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
Reference in New Issue
Block a user