Skip to content

Commit

Permalink
Rename package: params -> metadata
Browse files Browse the repository at this point in the history
Signed-off-by: Waldz <valdas@mysterium.network>
  • Loading branch information
Waldz committed Jun 25, 2018
1 parent 99b1507 commit 3665c83
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 38 deletions.
12 changes: 6 additions & 6 deletions cmd/commands/cli/command_cli.go
Expand Up @@ -21,7 +21,7 @@ import (
"fmt"
"github.com/chzyer/readline"
node_cmd "github.com/mysterium/node/cmd"
"github.com/mysterium/node/params"
"github.com/mysterium/node/metadata"
tequilapi_client "github.com/mysterium/node/tequilapi/client"
"io"
"log"
Expand Down Expand Up @@ -90,9 +90,9 @@ func (c *Command) Run() (err error) {

func printVersion() {
fmt.Println("Mysterium CLI")
fmt.Println("Version:", params.VersionAsString())
fmt.Println("Build info:", params.BuildAsString())
fmt.Println("Copyright:", params.GetStartupLicense(
fmt.Println("Version:", metadata.VersionAsString())
fmt.Println("Build info:", metadata.BuildAsString())
fmt.Println("Copyright:", metadata.GetStartupLicense(
"type 'license warranty'",
"type 'license conditions'",
))
Expand Down Expand Up @@ -358,9 +358,9 @@ func (c *Command) version(argsString string) {

func (c *Command) license(argsString string) {
if argsString == "warranty" {
fmt.Print(params.Warranty)
fmt.Print(metadata.Warranty)
} else if argsString == "conditions" {
fmt.Print(params.Conditions)
fmt.Print(metadata.Conditions)
} else {
info("identities command:\n warranty\n conditions")
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/commands/client/command_client.go
Expand Up @@ -28,9 +28,9 @@ import (
"github.com/mysterium/node/identity"
"github.com/mysterium/node/ip"
"github.com/mysterium/node/location"
"github.com/mysterium/node/metadata"
"github.com/mysterium/node/openvpn"
"github.com/mysterium/node/openvpn/middlewares/client/bytescount"
"github.com/mysterium/node/params"
"github.com/mysterium/node/server"
"github.com/mysterium/node/service_discovery/dto"
"github.com/mysterium/node/tequilapi"
Expand Down Expand Up @@ -123,7 +123,7 @@ type Command struct {

// Start starts Tequilapi service, fetches location
func (cmd *Command) Start() error {
log.Infof("Starting Mysterium Client (%s)", params.VersionAsString())
log.Infof("Starting Mysterium Client (%s)", metadata.VersionAsString())

err := cmd.checkOpenvpn()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/commands/server/command_server.go
Expand Up @@ -23,12 +23,12 @@ import (
"github.com/mysterium/node/identity"
"github.com/mysterium/node/ip"
"github.com/mysterium/node/location"
"github.com/mysterium/node/metadata"
"github.com/mysterium/node/nat"
"github.com/mysterium/node/openvpn"
"github.com/mysterium/node/openvpn/discovery"
"github.com/mysterium/node/openvpn/middlewares/state"
"github.com/mysterium/node/openvpn/tls"
"github.com/mysterium/node/params"
"github.com/mysterium/node/server"
dto_discovery "github.com/mysterium/node/service_discovery/dto"
"github.com/mysterium/node/session"
Expand Down Expand Up @@ -60,7 +60,7 @@ type Command struct {

// Start starts server - does not block
func (cmd *Command) Start() (err error) {
log.Infof("Starting Mysterium Server (%s)", params.VersionAsString())
log.Infof("Starting Mysterium Server (%s)", metadata.VersionAsString())

err = cmd.checkOpenvpn()
if err != nil {
Expand Down
12 changes: 6 additions & 6 deletions cmd/mysterium_client/mysterium_client.go
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/mysterium/node/cmd/commands/cli"
"github.com/mysterium/node/cmd/commands/client"
_ "github.com/mysterium/node/logconfig"
"github.com/mysterium/node/params"
"github.com/mysterium/node/metadata"
tequilapi_client "github.com/mysterium/node/tequilapi/client"
"os"
"path/filepath"
Expand All @@ -39,9 +39,9 @@ func main() {
if options.Version {
printVersion()
} else if options.LicenseWarranty {
fmt.Print(params.Warranty)
fmt.Print(metadata.Warranty)
} else if options.LicenseConditions {
fmt.Print(params.Conditions)
fmt.Print(metadata.Conditions)
} else if options.CLI {
runCLI(options)
} else {
Expand All @@ -52,9 +52,9 @@ func main() {

func printVersion() {
fmt.Println("Mysterium client")
fmt.Println("Version:", params.VersionAsString())
fmt.Println("Build info:", params.BuildAsString())
fmt.Println("Copyright:", params.GetStartupLicense(
fmt.Println("Version:", metadata.VersionAsString())
fmt.Println("Build info:", metadata.BuildAsString())
fmt.Println("Copyright:", metadata.GetStartupLicense(
"run program with '-license.warranty' option",
"run program with '-license.conditions' option",
))
Expand Down
12 changes: 6 additions & 6 deletions cmd/mysterium_server/mysterium_server.go
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/mysterium/node/cmd"
"github.com/mysterium/node/cmd/commands/server"
_ "github.com/mysterium/node/logconfig"
"github.com/mysterium/node/params"
"github.com/mysterium/node/metadata"
"os"
)

Expand All @@ -36,9 +36,9 @@ func main() {
if options.Version {
printVersion()
} else if options.LicenseWarranty {
fmt.Print(params.Warranty)
fmt.Print(metadata.Warranty)
} else if options.LicenseConditions {
fmt.Print(params.Conditions)
fmt.Print(metadata.Conditions)
} else {
printVersion()
runCMD(options)
Expand All @@ -47,9 +47,9 @@ func main() {

func printVersion() {
fmt.Println("Mysterium server")
fmt.Println("Version:", params.VersionAsString())
fmt.Println("Build info:", params.BuildAsString())
fmt.Println("Copyright:", params.GetStartupLicense(
fmt.Println("Version:", metadata.VersionAsString())
fmt.Println("Build info:", metadata.BuildAsString())
fmt.Println("Copyright:", metadata.GetStartupLicense(
"run program with '-warranty' option",
"run program with '-conditions' option",
))
Expand Down
4 changes: 2 additions & 2 deletions params/build_info.go → metadata/build_info.go
Expand Up @@ -15,9 +15,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

// Package params contains build information of executable usually provided by
// Package metadata contains build information of executable usually provided by
// automated build systems like Travis. Default values are populated if not overriden by build system
package params
package metadata

import "fmt"

Expand Down
2 changes: 1 addition & 1 deletion params/license.go → metadata/license.go
Expand Up @@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package params
package metadata

import "fmt"

Expand Down
2 changes: 1 addition & 1 deletion params/license_test.go → metadata/license_test.go
Expand Up @@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package params
package metadata

import (
"github.com/stretchr/testify/assert"
Expand Down
2 changes: 1 addition & 1 deletion params/version.go → metadata/version.go
Expand Up @@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package params
package metadata

import (
"fmt"
Expand Down
12 changes: 6 additions & 6 deletions tequilapi/endpoints/health_check.go
Expand Up @@ -19,7 +19,7 @@ package endpoints

import (
"github.com/julienschmidt/httprouter"
"github.com/mysterium/node/params"
"github.com/mysterium/node/metadata"
"github.com/mysterium/node/tequilapi/utils"
"net/http"
"time"
Expand Down Expand Up @@ -57,15 +57,15 @@ func HealthCheckEndpointFactory(currentTimeFunc func() time.Time, procID func()
}
}

func (hce *healthCheckEndpoint) HealthCheck(writer http.ResponseWriter, request *http.Request, routeParams httprouter.Params) {
func (hce *healthCheckEndpoint) HealthCheck(writer http.ResponseWriter, request *http.Request, params httprouter.Params) {
status := healthCheckData{
Uptime: hce.currentTimeFunc().Sub(hce.startTime).String(),
Process: hce.processNumber,
Version: params.VersionAsString(),
Version: metadata.VersionAsString(),
BuildInfo: buildInfo{
params.BuildCommit,
params.BuildBranch,
params.BuildNumber,
metadata.BuildCommit,
metadata.BuildBranch,
metadata.BuildNumber,
},
}
utils.WriteAsJSON(status, writer)
Expand Down
10 changes: 5 additions & 5 deletions tequilapi/endpoints/health_check_test.go
Expand Up @@ -19,7 +19,7 @@ package endpoints

import (
"github.com/julienschmidt/httprouter"
"github.com/mysterium/node/params"
"github.com/mysterium/node/metadata"
"github.com/stretchr/testify/assert"
"net/http/httptest"
"testing"
Expand All @@ -34,9 +34,9 @@ func TestHealthCheckReturnsExpectedJSONObject(t *testing.T) {
tick1 := time.Unix(0, 0)
tick2 := tick1.Add(time.Minute)

params.BuildBranch = "some"
params.BuildCommit = "abc123"
params.BuildNumber = "travis build #"
metadata.BuildBranch = "some"
metadata.BuildCommit = "abc123"
metadata.BuildNumber = "travis build #"

handlerFunc := HealthCheckEndpointFactory(
newMockTimer([]time.Time{tick1, tick2}).Now,
Expand All @@ -49,7 +49,7 @@ func TestHealthCheckReturnsExpectedJSONObject(t *testing.T) {
`{
"uptime" : "1m0s",
"process" : 1,
"version": "`+params.VersionAsString()+`",
"version": "`+metadata.VersionAsString()+`",
"buildInfo" : {
"branch": "some",
"commit": "abc123",
Expand Down

0 comments on commit 3665c83

Please sign in to comment.