fix: need to update config management in s5 protocol

This commit is contained in:
Derrick Hammer 2024-02-22 03:25:48 -05:00
parent 939e329591
commit a6218e9b7c
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 6 additions and 7 deletions

View File

@ -21,7 +21,6 @@ import (
s5storage "git.lumeweb.com/LumeWeb/libs5-go/storage" s5storage "git.lumeweb.com/LumeWeb/libs5-go/storage"
"git.lumeweb.com/LumeWeb/libs5-go/types" "git.lumeweb.com/LumeWeb/libs5-go/types"
"git.lumeweb.com/LumeWeb/portal/protocols/registry" "git.lumeweb.com/LumeWeb/portal/protocols/registry"
"github.com/spf13/viper"
bolt "go.etcd.io/bbolt" bolt "go.etcd.io/bbolt"
"go.uber.org/fx" "go.uber.org/fx"
"go.uber.org/zap" "go.uber.org/zap"
@ -64,7 +63,7 @@ type S5ProtocolResult struct {
type S5ProviderStoreParams struct { type S5ProviderStoreParams struct {
fx.In fx.In
Config *viper.Viper Config *config.Manager
Metadata metadata.MetadataService Metadata metadata.MetadataService
Logger *zap.Logger Logger *zap.Logger
Tus *TusHandler Tus *TusHandler
@ -228,7 +227,7 @@ func (s *S5Protocol) EncodeFileName(bytes []byte) string {
} }
type S5ProviderStore struct { type S5ProviderStore struct {
config *viper.Viper config *config.Manager
logger *zap.Logger logger *zap.Logger
tus *TusHandler tus *TusHandler
metadata metadata.MetadataService metadata metadata.MetadataService
@ -280,8 +279,8 @@ func calculateExpiry(duration time.Duration) int64 {
return time.Now().Add(duration).Unix() return time.Now().Add(duration).Unix()
} }
func generateDownloadUrl(hash *encoding.Multihash, config *viper.Viper, logger *zap.Logger) string { func generateDownloadUrl(hash *encoding.Multihash, config *config.Manager, logger *zap.Logger) string {
domain := config.GetString("core.domain") domain := config.Config().Core.Domain
hashStr, err := hash.ToBase64Url() hashStr, err := hash.ToBase64Url()
if err != nil { if err != nil {
@ -291,8 +290,8 @@ func generateDownloadUrl(hash *encoding.Multihash, config *viper.Viper, logger *
return fmt.Sprintf("https://s5.%s/s5/download/%s", domain, hashStr) return fmt.Sprintf("https://s5.%s/s5/download/%s", domain, hashStr)
} }
func generateProofUrl(hash *encoding.Multihash, config *viper.Viper, logger *zap.Logger) string { func generateProofUrl(hash *encoding.Multihash, config *config.Manager, logger *zap.Logger) string {
domain := config.GetString("core.domain") domain := config.Config().Core.Domain
hashStr, err := hash.ToBase64Url() hashStr, err := hash.ToBase64Url()
if err != nil { if err != nil {