Skip to content
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 a status command #3

Merged
merged 2 commits into from
Sep 19, 2016
Merged

Add a status command #3

merged 2 commits into from
Sep 19, 2016

Conversation

nono
Copy link
Member

@nono nono commented Sep 19, 2016

No description provided.

Run: func(cmd *cobra.Command, args []string) {
port := os.Getenv("PORT")
if len(port) == 0 {
port = "8080"
Copy link
Contributor

@aenario aenario Sep 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should let viper handle the whole config or ENV or default. Can be the object of a separate PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should be better. For the moment, it's just the default way of how gin works. But later, we should definetively move that in viper.

resp, err := http.Get("http:https://localhost:" + port + "/status")
if err != nil {
fmt.Println("Error the HTTP server is not running:", err)
os.Exit(1)
Copy link
Contributor

@aenario aenario Sep 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have significant error code ? In which case we should use named constants.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should just have 0 for OK and something else for an error. Error messages are more convenient to know what has failed.

@nono nono merged commit 76a4ad3 into master Sep 19, 2016
@nono nono deleted the status branch September 19, 2016 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants