diff --git a/web/satellite/src/utils/config.gen.ts b/web/satellite/src/utils/config.gen.ts new file mode 100644 index 000000000..3c8cda50e --- /dev/null +++ b/web/satellite/src/utils/config.gen.ts @@ -0,0 +1,61 @@ +// AUTOGENERATED BY configgen.go +// DO NOT EDIT. + +import { MemorySize } from '@/types/common'; + +export class CaptchaConfig { + login: MultiCaptchaConfig; + registration: MultiCaptchaConfig; +} + +export class FrontendConfig { + externalAddress: string; + satelliteName: string; + satelliteNodeURL: string; + stripePublicKey: string; + partneredSatellites: PartneredSatellite[]; + defaultProjectLimit: number; + generalRequestURL: string; + projectLimitsIncreaseRequestURL: string; + gatewayCredentialsRequestURL: string; + isBetaSatellite: boolean; + betaSatelliteFeedbackURL: string; + betaSatelliteSupportURL: string; + documentationURL: string; + couponCodeBillingUIEnabled: boolean; + couponCodeSignupUIEnabled: boolean; + fileBrowserFlowDisabled: boolean; + linksharingURL: string; + pathwayOverviewEnabled: boolean; + captcha: CaptchaConfig; + allProjectsDashboard: boolean; + defaultPaidStorageLimit: MemorySize; + defaultPaidBandwidthLimit: MemorySize; + newBillingScreen: boolean; + newAccessGrantFlow: boolean; + inactivityTimerEnabled: boolean; + inactivityTimerDuration: number; + inactivityTimerViewerEnabled: boolean; + optionalSignupSuccessURL: string; + homepageURL: string; + nativeTokenPaymentsEnabled: boolean; + passwordMinimumLength: number; + passwordMaximumLength: number; + abTestingEnabled: boolean; + pricingPackagesEnabled: boolean; +} + +export class MultiCaptchaConfig { + recaptcha: SingleCaptchaConfig; + hcaptcha: SingleCaptchaConfig; +} + +export class PartneredSatellite { + name: string; + address: string; +} + +export class SingleCaptchaConfig { + enabled: boolean; + siteKey: string; +} diff --git a/web/satellite/src/utils/configgen.go b/web/satellite/src/utils/configgen.go new file mode 100644 index 000000000..0ad22f0ba --- /dev/null +++ b/web/satellite/src/utils/configgen.go @@ -0,0 +1,45 @@ +// Copyright (C) 2023 Storj Labs, Inc. +// See LICENSE for copying information. + +package main + +//go:generate go run $GOFILE -o=config.gen.ts + +import ( + "flag" + "fmt" + "os" + "reflect" + "strings" + + "storj.io/storj/private/apigen" + "storj.io/storj/satellite/console/consoleweb" +) + +func main() { + flag.CommandLine = flag.NewFlagSet("configgen", flag.ExitOnError) + outPath := flag.String("o", "", "path to the output file") + flag.Parse() + + if *outPath == "" { + fmt.Fprintln(os.Stderr, "missing required argument -o") + os.Exit(1) + } + + var result apigen.StringBuilder + pf := result.Writelnf + + pf("// AUTOGENERATED BY configgen.go") + pf("// DO NOT EDIT.") + pf("") + + types := apigen.NewTypes() + types.Register(reflect.TypeOf(consoleweb.FrontendConfig{})) + result.WriteString(types.GenerateTypescriptDefinitions()) + + content := strings.ReplaceAll(result.String(), "\t", " ") + err := os.WriteFile("config.gen.ts", []byte(content), 0644) + if err != nil { + panic(err) + } +}