fix: use config for db

This commit is contained in:
Derrick Hammer 2024-01-12 06:37:01 -05:00
parent fa4a3e6f2a
commit 5fbac2ae13
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 6 additions and 1 deletions

View File

@ -47,6 +47,11 @@ func (s *S5Protocol) Initialize(config *viper.Viper, logger *zap.Logger) error {
cfg.HTTP.API.Domain = config.GetString("core.domain") cfg.HTTP.API.Domain = config.GetString("core.domain")
cfg.HTTP.API.Port = config.GetUint("core.port") cfg.HTTP.API.Port = config.GetUint("core.port")
dbPath := pconfig.GetString("dbPath")
if dbPath == "" {
logger.Fatal("dbPath is required")
}
_, p, err := ed25519.GenerateKey(nil) _, p, err := ed25519.GenerateKey(nil)
if err != nil { if err != nil {
@ -55,7 +60,7 @@ func (s *S5Protocol) Initialize(config *viper.Viper, logger *zap.Logger) error {
cfg.KeyPair = s5ed.New(p) cfg.KeyPair = s5ed.New(p)
db, err := bolt.Open("test.db", 0600, nil) db, err := bolt.Open(dbPath, 0600, nil)
if err != nil { if err != nil {
panic(err) panic(err)
} }