mirror of
https://github.com/dragonheim/gagent.git
synced 2025-05-24 12:16:47 -07:00
minor cleanup and standardization of package names.
This commit is contained in:
parent
3bb7096625
commit
d13a309593
9 changed files with 38 additions and 38 deletions
|
@ -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)
|
||||
|
|
|
@ -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{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue