satellite/access grant wizard: don't hardcode the satellites

Change-Id: Id9fbf68882cdb2fce846b7a2604cf965cc53ab1a
This commit is contained in:
JT Olio 2020-12-22 21:24:37 -07:00
parent efde103dba
commit 7faaeed2bf
6 changed files with 13 additions and 20 deletions

View File

@ -632,6 +632,7 @@ func NewAPI(log *zap.Logger, full *identity.FullIdentity, db DB,
peer.Marketing.PartnersService, peer.Marketing.PartnersService,
peer.Console.Listener, peer.Console.Listener,
config.Payments.StripeCoinPayments.StripePublicKey, config.Payments.StripeCoinPayments.StripePublicKey,
peer.URL(),
) )
peer.Servers.Add(lifecycle.Item{ peer.Servers.Add(lifecycle.Item{

View File

@ -30,6 +30,7 @@ import (
"golang.org/x/sync/errgroup" "golang.org/x/sync/errgroup"
"storj.io/common/errs2" "storj.io/common/errs2"
"storj.io/common/storj"
"storj.io/common/uuid" "storj.io/common/uuid"
"storj.io/storj/private/web" "storj.io/storj/private/web"
"storj.io/storj/satellite/console" "storj.io/storj/satellite/console"
@ -103,6 +104,7 @@ type Server struct {
server http.Server server http.Server
cookieAuth *consolewebauth.CookieAuth cookieAuth *consolewebauth.CookieAuth
rateLimiter *web.IPRateLimiter rateLimiter *web.IPRateLimiter
nodeURL storj.NodeURL
stripePublicKey string stripePublicKey string
@ -119,7 +121,7 @@ type Server struct {
} }
// NewServer creates new instance of console server. // 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{ server := Server{
log: logger, log: logger,
config: config, config: config,
@ -130,6 +132,7 @@ func NewServer(logger *zap.Logger, config Config, service *console.Service, mail
partners: partners, partners: partners,
stripePublicKey: stripePublicKey, stripePublicKey: stripePublicKey,
rateLimiter: web.NewIPRateLimiter(config.RateLimit), rateLimiter: web.NewIPRateLimiter(config.RateLimit),
nodeURL: nodeURL,
} }
logger.Debug("Starting Satellite UI.", zap.Stringer("Address", server.listener.Addr())) 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 { var data struct {
SatelliteName string SatelliteName string
SatelliteNodeURL string
SegmentIOPublicKey string SegmentIOPublicKey string
StripePublicKey string StripePublicKey string
VerificationPageURL string VerificationPageURL string
@ -293,6 +297,7 @@ func (server *Server) appHandler(w http.ResponseWriter, r *http.Request) {
} }
data.SatelliteName = server.config.SatelliteName data.SatelliteName = server.config.SatelliteName
data.SatelliteNodeURL = server.nodeURL.String()
data.SegmentIOPublicKey = server.config.SegmentIOPublicKey data.SegmentIOPublicKey = server.config.SegmentIOPublicKey
data.StripePublicKey = server.stripePublicKey data.StripePublicKey = server.stripePublicKey
data.VerificationPageURL = server.config.VerificationPageURL data.VerificationPageURL = server.config.VerificationPageURL

View File

@ -4,6 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"> <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="satellite-name" content="{{ .SatelliteName }}"> <meta name="satellite-name" content="{{ .SatelliteName }}">
<meta name="satellite-nodeurl" content="{{ .SatelliteNodeURL }}">
<meta name="segment-io" content="{{ .SegmentIOPublicKey }}"> <meta name="segment-io" content="{{ .SegmentIOPublicKey }}">
<meta name="stripe-public-key" content="{{ .StripePublicKey }}"> <meta name="stripe-public-key" content="{{ .StripePublicKey }}">
<meta name="verification-page-url" content="{{ .VerificationPageURL }}"> <meta name="verification-page-url" content="{{ .VerificationPageURL }}">

View File

@ -194,14 +194,14 @@ export default class CreatePassphraseStep extends Vue {
this.isLoading = true; this.isLoading = true;
const satelliteName = MetaUtils.getMetaContent('satellite-name'); const satelliteNodeURL = MetaUtils.getMetaContent('satellite-nodeurl');
this.worker.postMessage({ this.worker.postMessage({
'type': 'GenerateAccess', 'type': 'GenerateAccess',
'apiKey': this.restrictedKey, 'apiKey': this.restrictedKey,
'passphrase': this.passphrase, 'passphrase': this.passphrase,
'projectID': this.$store.getters.selectedProject.id, 'projectID': this.$store.getters.selectedProject.id,
'satelliteName': satelliteName, 'satelliteNodeURL': satelliteNodeURL,
}); });
// Give time for web worker to return value. // Give time for web worker to return value.

View File

@ -93,14 +93,14 @@ export default class EnterPassphraseStep extends Vue {
this.isLoading = true; this.isLoading = true;
const satelliteName = MetaUtils.getMetaContent('satellite-name'); const satelliteNodeURL = MetaUtils.getMetaContent('satellite-nodeurl');
this.worker.postMessage({ this.worker.postMessage({
'type': 'GenerateAccess', 'type': 'GenerateAccess',
'apiKey': this.restrictedKey, 'apiKey': this.restrictedKey,
'passphrase': this.passphrase, 'passphrase': this.passphrase,
'projectID': this.$store.getters.selectedProject.id, 'projectID': this.$store.getters.selectedProject.id,
'satelliteName': satelliteName, 'satelliteNodeURL': satelliteNodeURL,
}); });
// Give time for web worker to return value. // Give time for web worker to return value.

View File

@ -29,8 +29,7 @@ self.onmessage = function (event) {
apiKey = data.apiKey; apiKey = data.apiKey;
const passphrase = data.passphrase; const passphrase = data.passphrase;
const projectID = data.projectID; const projectID = data.projectID;
const satelliteName = data.satelliteName; const nodeURL = data.satelliteNodeURL;
const nodeURL = getSatelliteNodeURL(satelliteName);
result = self.generateAccessGrant(nodeURL, apiKey, passphrase, projectID); 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')); 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';
}
}