satellite/access grant wizard: don't hardcode the satellites
Change-Id: Id9fbf68882cdb2fce846b7a2604cf965cc53ab1a
This commit is contained in:
parent
efde103dba
commit
7faaeed2bf
@ -632,6 +632,7 @@ func NewAPI(log *zap.Logger, full *identity.FullIdentity, db DB,
|
||||
peer.Marketing.PartnersService,
|
||||
peer.Console.Listener,
|
||||
config.Payments.StripeCoinPayments.StripePublicKey,
|
||||
peer.URL(),
|
||||
)
|
||||
|
||||
peer.Servers.Add(lifecycle.Item{
|
||||
|
@ -30,6 +30,7 @@ import (
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"storj.io/common/errs2"
|
||||
"storj.io/common/storj"
|
||||
"storj.io/common/uuid"
|
||||
"storj.io/storj/private/web"
|
||||
"storj.io/storj/satellite/console"
|
||||
@ -103,6 +104,7 @@ type Server struct {
|
||||
server http.Server
|
||||
cookieAuth *consolewebauth.CookieAuth
|
||||
rateLimiter *web.IPRateLimiter
|
||||
nodeURL storj.NodeURL
|
||||
|
||||
stripePublicKey string
|
||||
|
||||
@ -119,7 +121,7 @@ type Server struct {
|
||||
}
|
||||
|
||||
// NewServer creates new instance of console server.
|
||||
func NewServer(logger *zap.Logger, config Config, service *console.Service, mailService *mailservice.Service, referralsService *referrals.Service, partners *rewards.PartnersService, listener net.Listener, stripePublicKey string) *Server {
|
||||
func NewServer(logger *zap.Logger, config Config, service *console.Service, mailService *mailservice.Service, referralsService *referrals.Service, partners *rewards.PartnersService, listener net.Listener, stripePublicKey string, nodeURL storj.NodeURL) *Server {
|
||||
server := Server{
|
||||
log: logger,
|
||||
config: config,
|
||||
@ -130,6 +132,7 @@ func NewServer(logger *zap.Logger, config Config, service *console.Service, mail
|
||||
partners: partners,
|
||||
stripePublicKey: stripePublicKey,
|
||||
rateLimiter: web.NewIPRateLimiter(config.RateLimit),
|
||||
nodeURL: nodeURL,
|
||||
}
|
||||
|
||||
logger.Debug("Starting Satellite UI.", zap.Stringer("Address", server.listener.Addr()))
|
||||
@ -281,6 +284,7 @@ func (server *Server) appHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var data struct {
|
||||
SatelliteName string
|
||||
SatelliteNodeURL string
|
||||
SegmentIOPublicKey string
|
||||
StripePublicKey string
|
||||
VerificationPageURL string
|
||||
@ -293,6 +297,7 @@ func (server *Server) appHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
data.SatelliteName = server.config.SatelliteName
|
||||
data.SatelliteNodeURL = server.nodeURL.String()
|
||||
data.SegmentIOPublicKey = server.config.SegmentIOPublicKey
|
||||
data.StripePublicKey = server.stripePublicKey
|
||||
data.VerificationPageURL = server.config.VerificationPageURL
|
||||
|
@ -4,6 +4,7 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<meta name="satellite-name" content="{{ .SatelliteName }}">
|
||||
<meta name="satellite-nodeurl" content="{{ .SatelliteNodeURL }}">
|
||||
<meta name="segment-io" content="{{ .SegmentIOPublicKey }}">
|
||||
<meta name="stripe-public-key" content="{{ .StripePublicKey }}">
|
||||
<meta name="verification-page-url" content="{{ .VerificationPageURL }}">
|
||||
|
@ -194,14 +194,14 @@ export default class CreatePassphraseStep extends Vue {
|
||||
|
||||
this.isLoading = true;
|
||||
|
||||
const satelliteName = MetaUtils.getMetaContent('satellite-name');
|
||||
const satelliteNodeURL = MetaUtils.getMetaContent('satellite-nodeurl');
|
||||
|
||||
this.worker.postMessage({
|
||||
'type': 'GenerateAccess',
|
||||
'apiKey': this.restrictedKey,
|
||||
'passphrase': this.passphrase,
|
||||
'projectID': this.$store.getters.selectedProject.id,
|
||||
'satelliteName': satelliteName,
|
||||
'satelliteNodeURL': satelliteNodeURL,
|
||||
});
|
||||
|
||||
// Give time for web worker to return value.
|
||||
|
@ -93,14 +93,14 @@ export default class EnterPassphraseStep extends Vue {
|
||||
|
||||
this.isLoading = true;
|
||||
|
||||
const satelliteName = MetaUtils.getMetaContent('satellite-name');
|
||||
const satelliteNodeURL = MetaUtils.getMetaContent('satellite-nodeurl');
|
||||
|
||||
this.worker.postMessage({
|
||||
'type': 'GenerateAccess',
|
||||
'apiKey': this.restrictedKey,
|
||||
'passphrase': this.passphrase,
|
||||
'projectID': this.$store.getters.selectedProject.id,
|
||||
'satelliteName': satelliteName,
|
||||
'satelliteNodeURL': satelliteNodeURL,
|
||||
});
|
||||
|
||||
// Give time for web worker to return value.
|
||||
|
@ -29,8 +29,7 @@ self.onmessage = function (event) {
|
||||
apiKey = data.apiKey;
|
||||
const passphrase = data.passphrase;
|
||||
const projectID = data.projectID;
|
||||
const satelliteName = data.satelliteName;
|
||||
const nodeURL = getSatelliteNodeURL(satelliteName);
|
||||
const nodeURL = data.satelliteNodeURL;
|
||||
|
||||
result = self.generateAccessGrant(nodeURL, apiKey, passphrase, projectID);
|
||||
|
||||
@ -63,16 +62,3 @@ self.onmessage = function (event) {
|
||||
self.postMessage(new Error('provided message event type is not supported'));
|
||||
}
|
||||
};
|
||||
|
||||
function getSatelliteNodeURL(satellite) {
|
||||
switch (satellite) {
|
||||
case 'Asia-East-1':
|
||||
return '121RTSDpyNZVcEU84Ticf2L1ntiuUimbWgfATz21tuvgk3vzoA6@asia-east-1.tardigrade.io:7777';
|
||||
case 'Europe-West-1':
|
||||
return '12L9ZFwhzVpuEKMUNUqkaTLGzwY9G24tbiigLiXpmZWKwmcNDDs@europe-west-1.tardigrade.io:7777';
|
||||
case 'US-Central-1':
|
||||
return '12EayRS2V1kEsWESU9QMRseFhdxYxKicsiFmxrsLZHeLUtdps3S@us-central-1.tardigrade.io:7777';
|
||||
default:
|
||||
return '12jHxTS7txdGgzeaXCSMR6yomWnD7nJcpz8QB7GrqxTAgftE5Y2@127.0.0.1:10000';
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user