satellite/peer: add payments config (#3488)

* satellite/peer: add payments config

* remove stripe-key from console config

* update config lock

* fix imports

* fix config-lock
This commit is contained in:
Yaroslav Vorobiov 2019-11-05 22:26:19 +02:00 committed by littleskunk
parent 841674e0e5
commit 0b32690d0a
5 changed files with 33 additions and 15 deletions

View File

@ -43,7 +43,6 @@ import (
"storj.io/storj/satellite/overlay"
"storj.io/storj/satellite/payments"
"storj.io/storj/satellite/payments/mockpayments"
"storj.io/storj/satellite/payments/paymentsconfig"
"storj.io/storj/satellite/payments/stripecoinpayments"
"storj.io/storj/satellite/repair/irreparable"
"storj.io/storj/satellite/rewards"
@ -366,15 +365,16 @@ func NewAPI(log *zap.Logger, full *identity.FullIdentity, db DB, pointerDB metai
}
{ // setup payments
config := paymentsconfig.Config{}
log.Debug("Satellite API Process setting up payments")
pc := config.Payments
switch config.Provider {
switch pc.Provider {
default:
peer.Payments.Accounts = mockpayments.Accounts()
case "stripecoinpayments":
service := stripecoinpayments.NewService(
peer.Log.Named("stripecoinpayments service"),
config.StripeCoinPayments,
pc.StripeCoinPayments,
peer.DB.StripeCoinPayments(),
peer.DB.Console().Projects())

View File

@ -54,7 +54,6 @@ type Config struct {
Address string `help:"server address of the graphql api gateway and frontend app" devDefault:"127.0.0.1:8081" releaseDefault:":10100"`
StaticDir string `help:"path to static resources" default:""`
ExternalAddress string `help:"external endpoint of the satellite if hosted" default:""`
StripeKey string `help:"stripe api key" default:""`
// TODO: remove after Vanguard release
AuthToken string `help:"auth token needed for access to registration token creation endpoint" default:""`

View File

@ -33,7 +33,6 @@ import (
"storj.io/storj/satellite/overlay"
"storj.io/storj/satellite/payments"
"storj.io/storj/satellite/payments/mockpayments"
"storj.io/storj/satellite/payments/paymentsconfig"
"storj.io/storj/satellite/payments/stripecoinpayments"
"storj.io/storj/satellite/repair/checker"
"storj.io/storj/satellite/repair/repairer"
@ -290,15 +289,16 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, pointerDB metainfo
// TODO: remove in future, should be in API
{ // setup payments
config := paymentsconfig.Config{}
log.Debug("Setting up payments")
pc := config.Payments
switch config.Provider {
switch pc.Provider {
default:
peer.Payments.Accounts = mockpayments.Accounts()
case "stripecoinpayments":
service := stripecoinpayments.NewService(
peer.Log.Named("stripecoinpayments service"),
config.StripeCoinPayments,
pc.StripeCoinPayments,
peer.DB.StripeCoinPayments(),
peer.DB.Console().Projects())
@ -307,8 +307,8 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, pointerDB metainfo
peer.Payments.Chore = stripecoinpayments.NewChore(
peer.Log.Named("stripecoinpayments clearing loop"),
service,
config.StripeCoinPayments.TransactionUpdateInterval,
config.StripeCoinPayments.AccountBalanceUpdateInterval)
pc.StripeCoinPayments.TransactionUpdateInterval,
pc.StripeCoinPayments.AccountBalanceUpdateInterval)
}
}

View File

@ -27,6 +27,7 @@ import (
"storj.io/storj/satellite/metrics"
"storj.io/storj/satellite/orders"
"storj.io/storj/satellite/overlay"
"storj.io/storj/satellite/payments/paymentsconfig"
"storj.io/storj/satellite/payments/stripecoinpayments"
"storj.io/storj/satellite/repair/checker"
"storj.io/storj/satellite/repair/irreparable"
@ -106,7 +107,10 @@ type Config struct {
Rollup rollup.Config
LiveAccounting live.Config
Mail mailservice.Config
Mail mailservice.Config
Payments paymentsconfig.Config
Console consoleweb.Config
Marketing marketingweb.Config

View File

@ -64,9 +64,6 @@
# path to static resources
# console.static-dir: ""
# stripe api key
# console.stripe-key: ""
# url link to terms and conditions page
# console.terms-and-conditions-url: https://storj.io/storage-sla/
@ -334,6 +331,24 @@ identity.key-path: /root/.local/share/storj/identity/satellite/identity.key
# number of update requests to process per transaction
# overlay.update-stats-batch-size: 100
# payments provider to use
# payments.provider: ""
# amount of time we wait before running next account balance update loop
# payments.stripe-coin-payments.account-balance-update-interval: 1h30m0s
# coinpayments API private key key
# payments.stripe-coin-payments.coinpayments-private-key: ""
# coinpayments API public key
# payments.stripe-coin-payments.coinpayments-public-key: ""
# stripe API secret key
# payments.stripe-coin-payments.stripe-secret-key: ""
# amount of time we wait before running next transaction update loop
# payments.stripe-coin-payments.transaction-update-interval: 30m0s
# time limit for downloading pieces from a node for repair
# repairer.download-timeout: 5m0s