minor cleanup and standardization of package names.

This commit is contained in:
James Wells 2023-06-30 17:47:45 -07:00
parent 3bb7096625
commit d13a309593
Signed by: jwells
GPG key ID: 73196D10B8E65666
9 changed files with 38 additions and 38 deletions

View file

@ -50,6 +50,7 @@ import (
var environment struct {
ConfigFile string `env:"GAGENT_CONFIG" envDefault:"/etc/gagent/gagent.hcl"`
LogLevel string `env:"GAGENT_LOGLEVEL" envDefault:"WARN"`
Mode string `env:"GAGENT_MODE" envDefault:"setup"`
MonitorPort int `env:"MONITOR_PORT" envDefault:"0"`
}
@ -134,15 +135,11 @@ func main() {
*/
func init() {
cfg := environment
if err := env.Parse(&cfg); err != nil {
log.Printf("%+v\n", err)
}
log.Printf("%+v\n", cfg)
env.Parse(&cfg)
filter := &logutils.LevelFilter{
Levels: []logutils.LogLevel{"DEBUG", "INFO", "WARN", "ERROR"},
MinLevel: logutils.LogLevel("DEBUG"),
MinLevel: logutils.LogLevel(cfg.LogLevel),
Writer: os.Stderr,
}
log.SetOutput(filter)

View file

@ -1,11 +1,11 @@
package main_test
package main
import (
"io/ioutil"
"os"
"testing"
main "github.com/dragonheim/gagent/cmd/gagent"
// main "github.com/dragonheim/gagent/cmd/gagent"
gstructs "github.com/dragonheim/gagent/internal/gstructs"
)
@ -47,7 +47,7 @@ func TestMain(t *testing.T) {
}
// Run the main function with the temporary config
main.Run(config)
t.Run(config)
// Check if the config has been set up correctly
expectedConfig := gstructs.GagentConfig{