Resolves #20. Print Chrly's version during server startup.

This commit is contained in:
ErickSkrauch 2020-04-23 21:22:12 +03:00
parent dbefac0e84
commit 2d555d9253
No known key found for this signature in database
GPG Key ID: 669339FCBB30EE0E
2 changed files with 4 additions and 0 deletions

View File

@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] - xxxx-xx-xx ## [Unreleased] - xxxx-xx-xx
### Added ### Added
- [#20](https://github.com/elyby/chrly/issues/20): Print hostname in the `version` command output. - [#20](https://github.com/elyby/chrly/issues/20): Print hostname in the `version` command output.
- [#21](https://github.com/elyby/chrly/issues/21): Print Chrly's version during server startup.
### Fixed ### Fixed
- [#22](https://github.com/elyby/chrly/issues/22): Correct version passing during building of the Docker image. - [#22](https://github.com/elyby/chrly/issues/22): Correct version passing during building of the Docker image.

View File

@ -13,6 +13,7 @@ import (
"github.com/mono83/slf/wd" "github.com/mono83/slf/wd"
"github.com/elyby/chrly/dispatcher" "github.com/elyby/chrly/dispatcher"
v "github.com/elyby/chrly/version"
) )
type Emitter interface { type Emitter interface {
@ -20,6 +21,8 @@ type Emitter interface {
} }
func StartServer(server *http.Server, logger slf.Logger) { func StartServer(server *http.Server, logger slf.Logger) {
logger.Debug("Chrly :v (:c)", wd.StringParam("v", v.Version()), wd.StringParam("c", v.Commit()))
done := make(chan bool, 1) done := make(chan bool, 1)
go func() { go func() {
logger.Info("Starting the server, HTTP on: :addr", wd.StringParam("addr", server.Addr)) logger.Info("Starting the server, HTTP on: :addr", wd.StringParam("addr", server.Addr))