refactor: put sia config under storage

This commit is contained in:
Derrick Hammer 2024-03-10 13:06:33 -04:00
parent b6683a5744
commit ae178f003f
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
4 changed files with 10 additions and 10 deletions

View File

@ -18,7 +18,6 @@ type CoreConfig struct {
Log LogConfig `mapstructure:"log"`
Port uint `mapstructure:"port"`
PostUploadLimit uint64 `mapstructure:"post_upload_limit"`
Sia SiaConfig `mapstructure:"sia"`
Storage StorageConfig `mapstructure:"storage"`
Protocols []string `mapstructure:"protocols"`
Mail MailConfig `mapstructure:"mail"`

View File

@ -2,4 +2,5 @@ package config
type StorageConfig struct {
S3 S3Config `mapstructure:"s3"`
Sia SiaConfig `mapstructure:"sia"`
}

View File

@ -102,27 +102,27 @@ SELECT AVG(rate) as average_rate FROM (
return err
}
gouge.MaxDownloadPrice, err = siacoinsFromFloat(p.config.Config().Core.Sia.MaxDownloadPrice / averageRate)
gouge.MaxDownloadPrice, err = siacoinsFromFloat(p.config.Config().Core.Storage.Sia.MaxDownloadPrice / averageRate)
if err != nil {
return err
}
gouge.MaxUploadPrice, err = siacoinsFromFloat(p.config.Config().Core.Sia.MaxUploadPrice / averageRate)
gouge.MaxUploadPrice, err = siacoinsFromFloat(p.config.Config().Core.Storage.Sia.MaxUploadPrice / averageRate)
if err != nil {
return err
}
gouge.MaxContractPrice, err = siacoinsFromFloat(p.config.Config().Core.Sia.MaxContractPrice / averageRate)
gouge.MaxContractPrice, err = siacoinsFromFloat(p.config.Config().Core.Storage.Sia.MaxContractPrice / averageRate)
if err != nil {
return err
}
gouge.MaxStoragePrice, err = siacoinsFromFloat(p.config.Config().Core.Sia.MaxStoragePrice / averageRate)
gouge.MaxStoragePrice, err = siacoinsFromFloat(p.config.Config().Core.Storage.Sia.MaxStoragePrice / averageRate)
if err != nil {
return err
}
gouge.MaxRPCPrice, err = siacoinsFromFloat(p.config.Config().Core.Sia.MaxRPCPrice / averageRate)
gouge.MaxRPCPrice, err = siacoinsFromFloat(p.config.Config().Core.Storage.Sia.MaxRPCPrice / averageRate)
if err != nil {
return err
}
@ -145,7 +145,7 @@ func (p PriceTracker) importPrices() error {
return err
}
daysOfHistory := p.config.Config().Core.Sia.PriceHistoryDays
daysOfHistory := p.config.Config().Core.Storage.Sia.PriceHistoryDays
// Check if the count is less than x
if uint64(count) < daysOfHistory {

View File

@ -111,8 +111,8 @@ func (r *RenterDefault) UploadObject(ctx context.Context, file io.Reader, bucket
}
func (r *RenterDefault) init() error {
addr := r.config.Config().Core.Sia.URL
passwd := r.config.Config().Core.Sia.Key
addr := r.config.Config().Core.Storage.Sia.URL
passwd := r.config.Config().Core.Storage.Sia.Key
addrURL, err := url.Parse(addr)