# HG changeset patch
# User Christophe de Vienne <christophe.devienne@orus.io>
# Date 1617112281 -7200
#      Tue Mar 30 15:51:21 2021 +0200
# Node ID 47a0379860f0f8b1178911727507e36bbb5bfe0e
# Parent  714427040ae353f3a42327aa8043ccff73d8fdf5
Add a CustomInfo so the application can add its own global flags

diff --git a/server.yaml b/server.yaml
--- a/server.yaml
+++ b/server.yaml
@@ -60,7 +60,12 @@
     - name: cmdServeConfig
       source: server/cmdServeConfig.gotmpl
       target: "{{ joinFilePath .Target \"cmd\" (dasherize (pascalize .Name)) }}/cmd"
-      file_name: serve-config.go
+      file_name: serve_config.go
+      skip_exists: true
+    - name: cmdCustomInfo
+      source: server/cmdCustomInfo.gotmpl
+      target: "{{ joinFilePath .Target \"cmd\" (dasherize (pascalize .Name)) }}/cmd"
+      file_name: custom_info.go
       skip_exists: true
     - name: configure
       source: server/configureapi.gotmpl
diff --git a/templates/server/cmd.gotmpl b/templates/server/cmd.gotmpl
--- a/templates/server/cmd.gotmpl
+++ b/templates/server/cmd.gotmpl
@@ -18,6 +18,7 @@
 
 type Info struct {
     Environment string `long:"environment" env:"ENVIRONMENT" ini-name:"environment" default:"default" description:"A environment name, used in sentry and prometheus"`
+    CustomInfo
 }
 
 var (
diff --git a/templates/server/cmdCustomInfo.gotmpl b/templates/server/cmdCustomInfo.gotmpl
new file mode 100644
--- /dev/null
+++ b/templates/server/cmdCustomInfo.gotmpl
@@ -0,0 +1,8 @@
+// This file is generated only once and is safe to edit
+
+package cmd
+
+type CustomInfo struct {
+    // Custom global flags can be added here. For example:
+    // BaseURL     string `long:"base-url" env:"BASE_URL" ini-name:"base-url" description:"The public facing base URL of the API. Used to forge URLs"`
+}