refactor: put sia config under storage
This commit is contained in:
parent
b6683a5744
commit
ae178f003f
|
@ -18,7 +18,6 @@ type CoreConfig struct {
|
||||||
Log LogConfig `mapstructure:"log"`
|
Log LogConfig `mapstructure:"log"`
|
||||||
Port uint `mapstructure:"port"`
|
Port uint `mapstructure:"port"`
|
||||||
PostUploadLimit uint64 `mapstructure:"post_upload_limit"`
|
PostUploadLimit uint64 `mapstructure:"post_upload_limit"`
|
||||||
Sia SiaConfig `mapstructure:"sia"`
|
|
||||||
Storage StorageConfig `mapstructure:"storage"`
|
Storage StorageConfig `mapstructure:"storage"`
|
||||||
Protocols []string `mapstructure:"protocols"`
|
Protocols []string `mapstructure:"protocols"`
|
||||||
Mail MailConfig `mapstructure:"mail"`
|
Mail MailConfig `mapstructure:"mail"`
|
||||||
|
|
|
@ -2,4 +2,5 @@ package config
|
||||||
|
|
||||||
type StorageConfig struct {
|
type StorageConfig struct {
|
||||||
S3 S3Config `mapstructure:"s3"`
|
S3 S3Config `mapstructure:"s3"`
|
||||||
|
Sia SiaConfig `mapstructure:"sia"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,27 +102,27 @@ SELECT AVG(rate) as average_rate FROM (
|
||||||
return err
|
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 {
|
if err != nil {
|
||||||
return err
|
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 {
|
if err != nil {
|
||||||
return err
|
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 {
|
if err != nil {
|
||||||
return err
|
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 {
|
if err != nil {
|
||||||
return err
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ func (p PriceTracker) importPrices() error {
|
||||||
return err
|
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
|
// Check if the count is less than x
|
||||||
if uint64(count) < daysOfHistory {
|
if uint64(count) < daysOfHistory {
|
||||||
|
|
|
@ -111,8 +111,8 @@ func (r *RenterDefault) UploadObject(ctx context.Context, file io.Reader, bucket
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RenterDefault) init() error {
|
func (r *RenterDefault) init() error {
|
||||||
addr := r.config.Config().Core.Sia.URL
|
addr := r.config.Config().Core.Storage.Sia.URL
|
||||||
passwd := r.config.Config().Core.Sia.Key
|
passwd := r.config.Config().Core.Storage.Sia.Key
|
||||||
|
|
||||||
addrURL, err := url.Parse(addr)
|
addrURL, err := url.Parse(addr)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue