start project #2
2 changed files with 7 additions and 6 deletions
start: rename config for split agent and futur intel
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
commit
c7bb3b353f
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.g3e.fr/syonad/two/internal/config"
|
configuration "git.g3e.fr/syonad/two/internal/config/agent"
|
||||||
"git.g3e.fr/syonad/two/pkg/db/kv"
|
"git.g3e.fr/syonad/two/pkg/db/kv"
|
||||||
"github.com/dgraph-io/badger/v4"
|
"github.com/dgraph-io/badger/v4"
|
||||||
)
|
)
|
||||||
|
|
@ -125,19 +125,17 @@ func printDB() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
configuration, err := config.LoadConfig("./two.yaml")
|
conf, err := configuration.LoadConfig("./two.yaml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
DB = kv.InitDB(kv.Config{
|
DB = kv.InitDB(kv.Config{
|
||||||
Path: configuration.Database.Path,
|
Path: conf.Database.Path,
|
||||||
})
|
})
|
||||||
defer DB.Close()
|
defer DB.Close()
|
||||||
|
|
||||||
printDB()
|
|
||||||
|
|
||||||
if len(os.Args) < 2 {
|
if len(os.Args) < 2 {
|
||||||
fmt.Println("Usage: db <cmd> [args...]")
|
fmt.Println("Usage: db <cmd> [args...]")
|
||||||
return
|
return
|
||||||
|
|
@ -186,6 +184,9 @@ func main() {
|
||||||
}
|
}
|
||||||
line, _ := GetFromDB(os.Args[2], os.Args[3])
|
line, _ := GetFromDB(os.Args[2], os.Args[3])
|
||||||
fmt.Println(line)
|
fmt.Println(line)
|
||||||
|
case "print":
|
||||||
|
printDB()
|
||||||
|
os.Exit(1)
|
||||||
default:
|
default:
|
||||||
fmt.Println("Unknown command:", cmd)
|
fmt.Println("Unknown command:", cmd)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package config
|
package configuration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue