Skip to content

Commit

Permalink
Fix config loading for tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
zachfi committed Oct 31, 2023
1 parent 5ef306f commit 706e485
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 6 additions & 3 deletions app/config.go
Expand Up @@ -2,15 +2,16 @@ package app

import (
"flag"
"io/ioutil"
"os"
"path/filepath"

"github.com/pkg/errors"
"github.com/weaveworks/common/server"
yaml "gopkg.in/yaml.v2"

"github.com/zachfi/weigh/modules/exporter"
"github.com/zachfi/zkit/pkg/tracing"

"github.com/zachfi/weigh/modules/exporter"
)

type Config struct {
Expand Down Expand Up @@ -38,7 +39,7 @@ func LoadConfig(file string) (Config, error) {

// loadYamlFile unmarshals a YAML file into the received interface{} or returns an error.
func loadYamlFile(filename string, d interface{}) error {
yamlFile, err := ioutil.ReadFile(filename)
yamlFile, err := os.ReadFile(filename)
if err != nil {
return err
}
Expand All @@ -54,4 +55,6 @@ func loadYamlFile(filename string, d interface{}) error {
func (c *Config) RegisterFlagsAndApplyDefaults(prefix string, f *flag.FlagSet) {
c.Target = Once
f.StringVar(&c.Target, "target", Once, "target module")

c.Tracing.RegisterFlagsAndApplyDefaults("tracing", f)
}
4 changes: 1 addition & 3 deletions cmd/weigh/main.go
Expand Up @@ -91,9 +91,7 @@ func loadConfig() (*app.Config, error) {
configFileOption = "config.file"
)

var (
configFile string
)
var configFile string

args := os.Args[1:]
config := &app.Config{}
Expand Down

0 comments on commit 706e485

Please sign in to comment.