consoleweb

package
v1.107.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2024 License: AGPL-3.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const ContentLengthLimit = 4 * memory.KB

ContentLengthLimit describes 4KB limit.

Variables

View Source
var (
	// Error is satellite console error type.
	Error = errs.Class("consoleweb")
)

Functions

func NewUserIDRateLimiter added in v1.39.4

func NewUserIDRateLimiter(config web.RateLimiterConfig, log *zap.Logger) *web.RateLimiter

NewUserIDRateLimiter constructs a RateLimiter that limits based on user ID.

Types

type Config

type Config struct {
	Address             string `help:"server address of the http api gateway and frontend app" devDefault:"127.0.0.1:0" releaseDefault:":10100"`
	FrontendAddress     string `help:"server address of the front-end app" devDefault:"127.0.0.1:0" releaseDefault:":10200"`
	ExternalAddress     string `help:"external endpoint of the satellite if hosted" default:""`
	FrontendEnable      bool   `help:"feature flag to toggle whether console back-end server should also serve front-end endpoints" default:"true"`
	BackendReverseProxy string `help:"the target URL of console back-end reverse proxy for local development when running a UI server" default:""`

	StaticDir string `help:"path to static resources" default:""`
	Watch     bool   `help:"whether to load templates on each request" default:"false" devDefault:"true"`

	AuthToken        string `help:"auth token needed for access to registration token creation endpoint" default:"" testDefault:"very-secret-token"`
	AuthTokenSecret  string `help:"secret used to sign auth tokens" releaseDefault:"" devDefault:"my-suppa-secret-key"`
	AuthCookieDomain string `help:"optional domain for cookies to use" default:""`

	ContactInfoURL                  string        `help:"url link to contacts page" default:"https://forum.storj.io"`
	ScheduleMeetingURL              string        `help:"url link to schedule a meeting with a storj representative" default:"https://meetings.hubspot.com/tom144/free-trial"`
	LetUsKnowURL                    string        `help:"url link to let us know page" default:"https://storjlabs.atlassian.net/servicedesk/customer/portals"`
	SEO                             string        `help:"used to communicate with web crawlers and other web robots" default:"User-agent: *\nDisallow: \nDisallow: /cgi-bin/"`
	SatelliteName                   string        `help:"used to display at web satellite console" default:"Storj"`
	SatelliteOperator               string        `help:"name of organization which set up satellite" default:"Storj Labs" `
	TermsAndConditionsURL           string        `help:"url link to terms and conditions page" default:"https://www.storj.io/terms-of-service/"`
	AccountActivationRedirectURL    string        `help:"url link for account activation redirect" default:""`
	PartneredSatellites             Satellites    `` /* 250-byte string literal not displayed */
	GeneralRequestURL               string        `` /* 127-byte string literal not displayed */
	ProjectLimitsIncreaseRequestURL string        `` /* 142-byte string literal not displayed */
	GatewayCredentialsRequestURL    string        `` /* 129-byte string literal not displayed */
	IsBetaSatellite                 bool          `help:"indicates if satellite is in beta" default:"false"`
	BetaSatelliteFeedbackURL        string        `help:"url link for for beta satellite feedback" default:""`
	BetaSatelliteSupportURL         string        `help:"url link for for beta satellite support" default:""`
	DocumentationURL                string        `help:"url link to documentation" default:"https://docs.storj.io/"`
	CouponCodeBillingUIEnabled      bool          `help:"indicates if user is allowed to add coupon codes to account from billing" default:"false"`
	CouponCodeSignupUIEnabled       bool          `help:"indicates if user is allowed to add coupon codes to account from signup" default:"false"`
	FileBrowserFlowDisabled         bool          `help:"indicates if file browser flow is disabled" default:"false"`
	LinksharingURL                  string        `` /* 144-byte string literal not displayed */
	PublicLinksharingURL            string        `` /* 133-byte string literal not displayed */
	PathwayOverviewEnabled          bool          `help:"indicates if the overview onboarding step should render with pathways" default:"true"`
	LimitsAreaEnabled               bool          `help:"indicates whether limit card section of the UI is enabled" default:"true"`
	GeneratedAPIEnabled             bool          `help:"indicates if generated console api should be used" default:"false"`
	OptionalSignupSuccessURL        string        `help:"optional url to external registration success page" default:""`
	HomepageURL                     string        `help:"url link to storj.io homepage" default:"https://www.storj.io"`
	NativeTokenPaymentsEnabled      bool          `help:"indicates if storj native token payments system is enabled" default:"false"`
	PricingPackagesEnabled          bool          `help:"whether to allow purchasing pricing packages" default:"false" devDefault:"true"`
	GalleryViewEnabled              bool          `help:"whether to show new gallery view" default:"true"`
	ObjectBrowserPaginationEnabled  bool          `help:"whether to use object browser pagination" default:"false"`
	LimitIncreaseRequestEnabled     bool          `help:"whether to allow request limit increases directly from the UI" default:"false"`
	AllowedUsageReportDateRange     time.Duration `help:"allowed usage report request date range" default:"9360h"`
	OnboardingStepperEnabled        bool          `help:"whether the onboarding stepper should be enabled" default:"false"`
	EnableRegionTag                 bool          `help:"whether to show region tag in UI" default:"false"`
	EmissionImpactViewEnabled       bool          `help:"whether emission impact view should be shown" default:"false"`
	ApplicationsPageEnabled         bool          `help:"whether applications page should be shown" default:"false"`
	DaysBeforeTrialEndNotification  int           `help:"days left before trial end notification" default:"3"`
	BadPasswordsFile                string        `help:"path to a local file with bad passwords list, empty path == skip check" default:""`
	NewAppSetupFlowEnabled          bool          `help:"whether new application setup flow should be used" default:"false"`

	OauthCodeExpiry         time.Duration `help:"how long oauth authorization codes are issued for" default:"10m"`
	OauthAccessTokenExpiry  time.Duration `help:"how long oauth access tokens are issued for" default:"24h"`
	OauthRefreshTokenExpiry time.Duration `help:"how long oauth refresh tokens are issued for" default:"720h"`

	BodySizeLimit memory.Size `help:"The maximum body size allowed to be received by the API" default:"100.00 KB"`

	// CSP configs
	CSPEnabled       bool   `help:"indicates if Content Security Policy is enabled" devDefault:"false" releaseDefault:"true"`
	FrameAncestors   string `help:"allow domains to embed the satellite in a frame, space separated" default:"tardigrade.io storj.io"`
	ImgSrcSuffix     string `` /* 149-byte string literal not displayed */
	ConnectSrcSuffix string `` /* 167-byte string literal not displayed */
	MediaSrcSuffix   string `` /* 151-byte string literal not displayed */

	// RateLimit defines the configuration for the IP and userID rate limiters.
	RateLimit web.RateLimiterConfig
	ABTesting abtesting.Config

	console.Config
}

Config contains configuration for console web server.

type FrontendConfig added in v1.74.1

type FrontendConfig struct {
	ExternalAddress                   string                `json:"externalAddress"`
	SatelliteName                     string                `json:"satelliteName"`
	SatelliteNodeURL                  string                `json:"satelliteNodeURL"`
	StripePublicKey                   string                `json:"stripePublicKey"`
	PartneredSatellites               []PartneredSatellite  `json:"partneredSatellites"`
	DefaultProjectLimit               int                   `json:"defaultProjectLimit"`
	GeneralRequestURL                 string                `json:"generalRequestURL"`
	ProjectLimitsIncreaseRequestURL   string                `json:"projectLimitsIncreaseRequestURL"`
	GatewayCredentialsRequestURL      string                `json:"gatewayCredentialsRequestURL"`
	IsBetaSatellite                   bool                  `json:"isBetaSatellite"`
	BetaSatelliteFeedbackURL          string                `json:"betaSatelliteFeedbackURL"`
	BetaSatelliteSupportURL           string                `json:"betaSatelliteSupportURL"`
	DocumentationURL                  string                `json:"documentationURL"`
	CouponCodeBillingUIEnabled        bool                  `json:"couponCodeBillingUIEnabled"`
	CouponCodeSignupUIEnabled         bool                  `json:"couponCodeSignupUIEnabled"`
	FileBrowserFlowDisabled           bool                  `json:"fileBrowserFlowDisabled"`
	LinksharingURL                    string                `json:"linksharingURL"`
	PublicLinksharingURL              string                `json:"publicLinksharingURL"`
	PathwayOverviewEnabled            bool                  `json:"pathwayOverviewEnabled"`
	Captcha                           console.CaptchaConfig `json:"captcha"`
	LimitsAreaEnabled                 bool                  `json:"limitsAreaEnabled"`
	DefaultPaidStorageLimit           memory.Size           `json:"defaultPaidStorageLimit"`
	DefaultPaidBandwidthLimit         memory.Size           `json:"defaultPaidBandwidthLimit"`
	InactivityTimerEnabled            bool                  `json:"inactivityTimerEnabled"`
	InactivityTimerDuration           int                   `json:"inactivityTimerDuration"`
	InactivityTimerViewerEnabled      bool                  `json:"inactivityTimerViewerEnabled"`
	OptionalSignupSuccessURL          string                `json:"optionalSignupSuccessURL"`
	HomepageURL                       string                `json:"homepageURL"`
	NativeTokenPaymentsEnabled        bool                  `json:"nativeTokenPaymentsEnabled"`
	PasswordMinimumLength             int                   `json:"passwordMinimumLength"`
	PasswordMaximumLength             int                   `json:"passwordMaximumLength"`
	ABTestingEnabled                  bool                  `json:"abTestingEnabled"`
	PricingPackagesEnabled            bool                  `json:"pricingPackagesEnabled"`
	GalleryViewEnabled                bool                  `json:"galleryViewEnabled"`
	NeededTransactionConfirmations    int                   `json:"neededTransactionConfirmations"`
	ObjectBrowserPaginationEnabled    bool                  `json:"objectBrowserPaginationEnabled"`
	BillingFeaturesEnabled            bool                  `json:"billingFeaturesEnabled"`
	StripePaymentElementEnabled       bool                  `json:"stripePaymentElementEnabled"`
	UnregisteredInviteEmailsEnabled   bool                  `json:"unregisteredInviteEmailsEnabled"`
	UserBalanceForUpgrade             int64                 `json:"userBalanceForUpgrade"`
	LimitIncreaseRequestEnabled       bool                  `json:"limitIncreaseRequestEnabled"`
	SignupActivationCodeEnabled       bool                  `json:"signupActivationCodeEnabled"`
	AllowedUsageReportDateRange       time.Duration         `json:"allowedUsageReportDateRange"`
	OnboardingStepperEnabled          bool                  `json:"onboardingStepperEnabled"`
	EnableRegionTag                   bool                  `json:"enableRegionTag"`
	EmissionImpactViewEnabled         bool                  `json:"emissionImpactViewEnabled"`
	ApplicationsPageEnabled           bool                  `json:"applicationsPageEnabled"`
	DaysBeforeTrialEndNotification    int                   `json:"daysBeforeTrialEndNotification"`
	AnalyticsEnabled                  bool                  `json:"analyticsEnabled"`
	NewAppSetupFlowEnabled            bool                  `json:"newAppSetupFlowEnabled"`
	ObjectBrowserKeyNamePrefix        string                `json:"objectBrowserKeyNamePrefix"`
	ObjectBrowserKeyLifetime          time.Duration         `json:"objectBrowserKeyLifetime"`
	MaxNameCharacters                 int                   `json:"maxNameCharacters"`
	BillingInformationTabEnabled      bool                  `json:"billingInformationTabEnabled"`
	SatelliteManagedEncryptionEnabled bool                  `json:"satelliteManagedEncryptionEnabled"`
	EmailChangeFlowEnabled            bool                  `json:"emailChangeFlowEnabled"`
	SelfServeAccountDeleteEnabled     bool                  `json:"selfServeAccountDeleteEnabled"`
}

FrontendConfig holds the configuration for the satellite frontend.

type PartneredSatellite added in v1.74.1

type PartneredSatellite struct {
	Name    string `json:"name"`
	Address string `json:"address"`
}

PartneredSatellite contains the name and web address of a satellite.

type Satellites added in v1.74.1

type Satellites []PartneredSatellite

Satellites is a configuration value that contains a list of satellite names and addresses. Format should be [{"name": "","address": ""],{"name": "","address": ""},...] in valid JSON format.

Can be used as a flag.

func (*Satellites) Set added in v1.74.1

func (sl *Satellites) Set(s string) (err error)

Set does validation on the configured JSON.

func (*Satellites) String added in v1.74.1

func (sl *Satellites) String() string

String is required for pflag.Value.

func (Satellites) Type added in v1.74.1

func (Satellites) Type() string

Type implements pflag.Value.

type Server

type Server struct {
	AnalyticsConfig analytics.Config
	// contains filtered or unexported fields
}

Server represents console web server.

architecture: Endpoint

func NewFrontendServer added in v1.84.1

func NewFrontendServer(logger *zap.Logger, config Config, listener net.Listener, nodeURL storj.NodeURL, stripePublicKey string) (server *Server, err error)

NewFrontendServer creates new instance of console front-end server. NB: The return type is currently consoleweb.Server, but it does not contain all the dependencies. It should only be used with RunFrontEnd and Close. We plan on moving this to its own type, but right now since we have a feature flag to allow the backend server to continue serving the frontend, it makes it easier if they are the same type.

func NewServer

func NewServer(logger *zap.Logger, config Config, service *console.Service, oidcService *oidc.Service, mailService *mailservice.Service, analytics *analytics.Service, abTesting *abtesting.Service, accountFreezeService *console.AccountFreezeService, listener net.Listener, stripePublicKey string, neededTokenPaymentConfirmations int, nodeURL storj.NodeURL, analyticsConfig analytics.Config, packagePlans paymentsconfig.PackagePlans) *Server

NewServer creates new instance of console server.

func (*Server) Close

func (server *Server) Close() error

Close closes server and underlying listener.

func (*Server) Run

func (server *Server) Run(ctx context.Context) (err error)

Run starts the server that host webapp and api endpoint.

func (*Server) RunFrontend added in v1.84.1

func (server *Server) RunFrontend(ctx context.Context) (err error)

RunFrontend starts the server that runs the webapp.

Directories

Path Synopsis
gen

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL