Skip to content

Commit e81a2f3

Browse files
committed
Make default source a flag rather than reading the envvar directly
Signed-off-by: Adam Wolfe Gordon <[email protected]>
1 parent 3bfa558 commit e81a2f3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

main.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
package main
33

44
import (
5-
"os"
6-
75
"github.com/alecthomas/kong"
8-
96
"github.com/crossplane/function-sdk-go"
107
)
118

@@ -18,6 +15,8 @@ type CLI struct {
1815
TLSCertsDir string `help:"Directory containing server certs (tls.key, tls.crt) and the CA used to verify client certificates (ca.crt)" env:"TLS_SERVER_CERTS_DIR"`
1916
Insecure bool `help:"Run without mTLS credentials. If you supply this flag --tls-server-certs-dir will be ignored."`
2017
MaxRecvMessageSize int `help:"Maximum size of received messages in MB." default:"4"`
18+
19+
DefaultSource string `help:"Default template source to use when input is not provided to the function." default:"" env:"FUNCTION_GO_TEMPLATING_DEFAULT_SOURCE"`
2120
}
2221

2322
// Run this Function.
@@ -31,7 +30,7 @@ func (c *CLI) Run() error {
3130
&Function{
3231
log: log,
3332
fsys: &osFS{},
34-
defaultSource: os.Getenv("FUNCTION_GO_TEMPLATING_DEFAULT_SOURCE"),
33+
defaultSource: c.DefaultSource,
3534
},
3635
function.Listen(c.Network, c.Address),
3736
function.MTLSCertificates(c.TLSCertsDir),

0 commit comments

Comments
 (0)