satellite/orders: add encryption keys flag to Service
Change-Id: Ie96e75bc96241b799d04654ef5e05b82e6a899bb
This commit is contained in:
parent
1f711523d5
commit
61b17f1214
@ -329,7 +329,7 @@ func NewAPI(log *zap.Logger, full *identity.FullIdentity, db DB,
|
|||||||
peer.Overlay.Service,
|
peer.Overlay.Service,
|
||||||
peer.Orders.DB,
|
peer.Orders.DB,
|
||||||
peer.DB.Buckets(),
|
peer.DB.Buckets(),
|
||||||
config.Orders.Expiration,
|
config.Orders,
|
||||||
&pb.NodeAddress{
|
&pb.NodeAddress{
|
||||||
Transport: pb.NodeTransport_TCP_TLS_GRPC,
|
Transport: pb.NodeTransport_TCP_TLS_GRPC,
|
||||||
Address: config.Contact.ExternalAddress,
|
Address: config.Contact.ExternalAddress,
|
||||||
|
@ -269,7 +269,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB,
|
|||||||
peer.Overlay.Service,
|
peer.Overlay.Service,
|
||||||
peer.Orders.DB,
|
peer.Orders.DB,
|
||||||
peer.DB.Buckets(),
|
peer.DB.Buckets(),
|
||||||
config.Orders.Expiration,
|
config.Orders,
|
||||||
&pb.NodeAddress{
|
&pb.NodeAddress{
|
||||||
Transport: pb.NodeTransport_TCP_TLS_GRPC,
|
Transport: pb.NodeTransport_TCP_TLS_GRPC,
|
||||||
Address: config.Contact.ExternalAddress,
|
Address: config.Contact.ExternalAddress,
|
||||||
|
@ -114,6 +114,9 @@ func (keys *EncryptionKeys) Set(s string) error {
|
|||||||
if keys.KeyByID == nil {
|
if keys.KeyByID == nil {
|
||||||
keys.KeyByID = map[EncryptionKeyID]storj.Key{}
|
keys.KeyByID = map[EncryptionKeyID]storj.Key{}
|
||||||
}
|
}
|
||||||
|
if s == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
for _, x := range strings.Split(s, ",") {
|
for _, x := range strings.Split(s, ",") {
|
||||||
x = strings.TrimSpace(x)
|
x = strings.TrimSpace(x)
|
||||||
|
@ -27,6 +27,7 @@ var ErrDownloadFailedNotEnoughPieces = errs.Class("not enough pieces for downloa
|
|||||||
|
|
||||||
// Config is a configuration struct for orders Service.
|
// Config is a configuration struct for orders Service.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
EncryptionKeys EncryptionKeys `help:"encryption keys to encrypt info in orders" default:""`
|
||||||
Expiration time.Duration `help:"how long until an order expires" default:"48h"` // 2 days
|
Expiration time.Duration `help:"how long until an order expires" default:"48h"` // 2 days
|
||||||
SettlementBatchSize int `help:"how many orders to batch per transaction" default:"250"`
|
SettlementBatchSize int `help:"how many orders to batch per transaction" default:"250"`
|
||||||
FlushBatchSize int `help:"how many items in the rollups write cache before they are flushed to the database" devDefault:"20" releaseDefault:"10000"`
|
FlushBatchSize int `help:"how many items in the rollups write cache before they are flushed to the database" devDefault:"20" releaseDefault:"10000"`
|
||||||
@ -51,8 +52,11 @@ type Service struct {
|
|||||||
overlay *overlay.Service
|
overlay *overlay.Service
|
||||||
orders DB
|
orders DB
|
||||||
buckets BucketsDB
|
buckets BucketsDB
|
||||||
|
|
||||||
|
encryptionKeys EncryptionKeys
|
||||||
satelliteAddress *pb.NodeAddress
|
satelliteAddress *pb.NodeAddress
|
||||||
orderExpiration time.Duration
|
orderExpiration time.Duration
|
||||||
|
|
||||||
rngMu sync.Mutex
|
rngMu sync.Mutex
|
||||||
rng *mathrand.Rand
|
rng *mathrand.Rand
|
||||||
}
|
}
|
||||||
@ -61,7 +65,8 @@ type Service struct {
|
|||||||
func NewService(
|
func NewService(
|
||||||
log *zap.Logger, satellite signing.Signer, overlay *overlay.Service,
|
log *zap.Logger, satellite signing.Signer, overlay *overlay.Service,
|
||||||
orders DB, buckets BucketsDB,
|
orders DB, buckets BucketsDB,
|
||||||
orderExpiration time.Duration, satelliteAddress *pb.NodeAddress,
|
config Config,
|
||||||
|
satelliteAddress *pb.NodeAddress,
|
||||||
) *Service {
|
) *Service {
|
||||||
return &Service{
|
return &Service{
|
||||||
log: log,
|
log: log,
|
||||||
@ -69,8 +74,10 @@ func NewService(
|
|||||||
overlay: overlay,
|
overlay: overlay,
|
||||||
orders: orders,
|
orders: orders,
|
||||||
buckets: buckets,
|
buckets: buckets,
|
||||||
|
|
||||||
|
encryptionKeys: config.EncryptionKeys,
|
||||||
satelliteAddress: satelliteAddress,
|
satelliteAddress: satelliteAddress,
|
||||||
orderExpiration: orderExpiration,
|
orderExpiration: config.Expiration,
|
||||||
|
|
||||||
rng: mathrand.New(mathrand.NewSource(time.Now().UnixNano())),
|
rng: mathrand.New(mathrand.NewSource(time.Now().UnixNano())),
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ func NewRepairer(log *zap.Logger, full *identity.FullIdentity,
|
|||||||
peer.Overlay,
|
peer.Overlay,
|
||||||
peer.Orders.DB,
|
peer.Orders.DB,
|
||||||
bucketsDB,
|
bucketsDB,
|
||||||
config.Orders.Expiration,
|
config.Orders,
|
||||||
&pb.NodeAddress{
|
&pb.NodeAddress{
|
||||||
Transport: pb.NodeTransport_TCP_TLS_GRPC,
|
Transport: pb.NodeTransport_TCP_TLS_GRPC,
|
||||||
Address: config.Contact.ExternalAddress,
|
Address: config.Contact.ExternalAddress,
|
||||||
|
3
scripts/testdata/satellite-config.yaml.lock
vendored
3
scripts/testdata/satellite-config.yaml.lock
vendored
@ -442,6 +442,9 @@ identity.key-path: /root/.local/share/storj/identity/satellite/identity.key
|
|||||||
# path to log for oom notices
|
# path to log for oom notices
|
||||||
# monkit.hw.oomlog: /var/log/kern.log
|
# monkit.hw.oomlog: /var/log/kern.log
|
||||||
|
|
||||||
|
# encryption keys to encrypt info in orders
|
||||||
|
# orders.encryption-keys: ""
|
||||||
|
|
||||||
# how long until an order expires
|
# how long until an order expires
|
||||||
# orders.expiration: 48h0m0s
|
# orders.expiration: 48h0m0s
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user