-
Notifications
You must be signed in to change notification settings - Fork 758
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
Rename pbs_light.go To main.go #1074
Conversation
glog.Errorf("prebid-server failed: %v", err) | ||
} | ||
} | ||
|
||
func loadConfig() (*config.Configuration, error) { |
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.
Moved the Viper setup logic into its own method to mirror the encapsulation of the server setup. IMHO, this seems easier to read.
if err := serve(Rev, cfg); err != nil { | ||
|
||
err = serve(Rev, cfg) | ||
if err != nil { |
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.
The call to loadConfig cannot be inlined within the if
block since the cfg
is needed outside the block. Changing the usage of the server call to match for (hopefully you'll agree) improved readability.
func serve(revision string, cfg *config.Configuration) error { | ||
currencyConverter := currencies.NewRateConverter(&http.Client{}, cfg.CurrencyConverter.FetchURL, time.Duration(cfg.CurrencyConverter.FetchIntervalSeconds)*time.Second) |
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.
This line was quite long. Pulled out the time conversion.
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.
Nice :)
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.
LGTM
It is common for the main func to be contained within main.go. I understand the pbs_light name is an artifact of an earlier phase of the project. I suggest renaming the app entry point for clarity.