Skip to content
This repository has been archived by the owner on Oct 2, 2022. It is now read-only.

Commit

Permalink
JSON / YAML compatibility (#3)
Browse files Browse the repository at this point in the history
* Fixed missing inline tag on marshaling.

* Bump log to 0.9.5

* Changelog
  • Loading branch information
Janos Pasztor authored Dec 10, 2020
1 parent e0eb998 commit 0b7d33e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Changelog

## 0.9.2: Fixed JSON and YAML marshalling

In the previous version the JSON and YAML configuration marshalling / unmarshalling created an unnecessary sub-map, which was incompatible to ContainerSSH 0.3. This release fixes that and restores compatibility.

## 0.9.1: Updating GeoIP to 0.9.3

This release updates the [GeoIP dependency](https://github.com/containerssh/geoip) to version 0.9.3 for a cleaner API.

## 0.9.0: Initial release

This is the initial port from ContainerSSH 0.3
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.14
require (
github.com/containerssh/geoip v0.9.3
github.com/containerssh/http v0.9.1
github.com/containerssh/log v0.9.2
github.com/containerssh/log v0.9.5
github.com/containerssh/service v0.9.0
github.com/stretchr/testify v1.6.1
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ github.com/containerssh/http v0.9.1 h1:n7fNwRoZR+HsuAinuIdDbSl28O/d9O7raoUUYyeQk
github.com/containerssh/http v0.9.1/go.mod h1:rKeRa8glbNsA08etU2HkRAsQ5Wn9J6Ht8Ly/aSNXC/I=
github.com/containerssh/log v0.9.2 h1:QngZdg3EFvFxthpJY4X2qgVwqSHFTzHJ2kCiQkR7FLQ=
github.com/containerssh/log v0.9.2/go.mod h1:05pgNm7IgFKt+qbZiUhtuJw2B4j3ynn2vSv5j2JA7hA=
github.com/containerssh/log v0.9.5 h1:uXBtOr0ao/0plopnIz0trAH7VmIYQUDhKwoZsZ20ufM=
github.com/containerssh/log v0.9.5/go.mod h1:P/tea/If6kzzfqlZdmqNp5SOpD6CD/OvmvcOK+vbweI=
github.com/containerssh/service v0.9.0 h1:JUHqiK12tclq7EWQYGRTfgKKw6fhHs0gxlKWTvVwFlQ=
github.com/containerssh/service v0.9.0/go.mod h1:otAKYF1MWy2eB0K7Sk7YQIECQMTHR3yikbyS1UstGpY=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
Expand Down
2 changes: 1 addition & 1 deletion server_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
)

type Config struct {
http.ServerConfiguration
http.ServerConfiguration `json:",inline" yaml:",inline"`

Enable bool `yaml:"enable" json:"enable" comment:"Enable metrics server." default:"false"`
Path string `yaml:"path" json:"path" comment:"Path to run the Metrics endpoint on." default:"/metrics"`
Expand Down
9 changes: 7 additions & 2 deletions server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import (
"io/ioutil"
"net"
goHttp "net/http"
"os"
"strings"
"testing"

"github.com/containerssh/http"
"github.com/containerssh/log/standard"
"github.com/containerssh/log"
"github.com/containerssh/service"
"github.com/stretchr/testify/assert"

Expand All @@ -18,7 +19,11 @@ import (

func TestFetchMetrics(t *testing.T) {
geoip := &geoIpLookupProvider{}
logger := standard.New()
logger, err := log.New(log.Config{
Level: log.LevelDebug,
Format: "text",
}, "metrics", os.Stdout)
assert.NoError(t, err)
m := metrics.New(geoip)
counter, err := m.CreateCounter("test", "pc", "Test metric")
assert.Nil(t, err)
Expand Down

0 comments on commit 0b7d33e

Please sign in to comment.