-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add default configuration values #316
base: main
Are you sure you want to change the base?
Changes from 1 commit
f933203
6bdc6f1
6f83814
193f076
9590ec4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,17 @@ type config struct { | |
} | ||
} | ||
|
||
func setConfigDefaults() (config) { | ||
var conf config | ||
conf.Pebble.ListenAddress = "0.0.0.0:14000" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a comment showing readers that these values are identical to the values in |
||
conf.Pebble.ManagementListenAddress = "0.0.0.0:15000" | ||
conf.Pebble.Certificate = "test/certs/localhost/cert.pem" | ||
conf.Pebble.PrivateKey = "test/certs/localhost/key.pem" | ||
conf.Pebble.HTTPPort = 5002 | ||
conf.Pebble.TLSPort = 5001 | ||
return conf | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are two values ( |
||
} | ||
|
||
func main() { | ||
configFile := flag.String( | ||
"config", | ||
|
@@ -52,7 +63,7 @@ func main() { | |
logger := log.New(os.Stdout, "Pebble ", log.LstdFlags) | ||
logger.Printf("Starting Pebble ACME server") | ||
|
||
var c config | ||
c := setConfigDefaults() | ||
err := cmd.ReadConfigFile(*configFile, &c) | ||
cmd.FailOnError(err, "Reading JSON config file into config structure") | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: because this is creating a new config object, rather than setting values on a pre-existing config object, I'd call it
getDefaultConfig
rather thansetConfigDefaults
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what you get for not updating your function names when you change what it does 🤦