diff --git a/app/transports/api/api.go b/app/transports/api/api.go index f12610500..e067ee3fb 100644 --- a/app/transports/api/api.go +++ b/app/transports/api/api.go @@ -47,8 +47,9 @@ func Build() fx.Option { router := chi.NewRouter() origins := []string{ - "http://localhost:3000", // Local development, `npm run dev` - cfg.PublicWebAddress, // Live public website + "http://localhost:3000", // Local development, `npm run dev` + cfg.LauncherBackendAddress, // Launcher backend address + cfg.PublicWebAddress, // Live public website } l.Debug("preparing router", zap.Strings("origins", origins)) diff --git a/fly.toml b/fly.toml index 3af037d27..2d9b1a347 100644 --- a/fly.toml +++ b/fly.toml @@ -11,11 +11,12 @@ processes = [] auto_rollback = true [env] - LOG_LEVEL = "debug" - PACKAGES_DB = "/data/packages.db" - CACHED_SERVERS_FILE = "/data/cachedServers.json" - PRODUCTION = "true" - PUBLIC_WEB_ADDRESS = "https://www.open.mp" + LOG_LEVEL = "debug" + PACKAGES_DB = "/data/packages.db" + CACHED_SERVERS_FILE = "/data/cachedServers.json" + PRODUCTION = "true" + PUBLIC_WEB_ADDRESS = "https://www.open.mp" + LAUNCHER_BACKEND_ADDRESS = "http://localhost:1420" [mounts] destination = "/data" diff --git a/internal/config/config.go b/internal/config/config.go index 83eee9227..038e6d0a8 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -12,25 +12,26 @@ type Config struct { Production bool `envconfig:"PRODUCTION" default:"false"` LogLevel zapcore.Level `envconfig:"LOG_LEVEL" default:"info"` - DatabaseURL string `envconfig:"DATABASE_URL" required:"true"` - ListenAddr string `envconfig:"LISTEN_ADDR" default:"0.0.0.0:8000"` - CookieDomain string `envconfig:"COOKIE_DOMAIN" default:".open.mp"` - PublicWebAddress string `envconfig:"PUBLIC_WEB_ADDRESS" default:"https://open.mp"` - PublicApiAddress string `envconfig:"PUBLIC_API_ADDRESS" default:"https://api.open.mp"` - HashKey []byte `envconfig:"HASH_KEY" required:"true"` - BlockKey []byte `envconfig:"BLOCK_KEY" required:"true"` - GithubClientID string `envconfig:"GITHUB_CLIENT_ID" required:"true"` - GithubClientSecret string `envconfig:"GITHUB_CLIENT_SECRET" required:"true"` - DiscordClientID string `envconfig:"DISCORD_CLIENT_ID" required:"true"` - DiscordClientSecret string `envconfig:"DISCORD_CLIENT_SECRET" required:"true"` - GithubToken string `envconfig:"GITHUB_TOKEN" required:"true"` - DocsSourcesPath string `envconfig:"DOCS_SOURCES_PATH" required:"false" default:"docs/"` - DocsIndexPath string `envconfig:"DOCS_INDEX_PATH" required:"false" default:"docs.bleve"` - PackagesDB string `envconfig:"PACKAGES_DB" required:"false" default:"data/packages.db"` - CachedServers string `envconfig:"CACHED_SERVERS_FILE" required:"false" default:"data/cachedServers.json"` - ServerScrapeInterval time.Duration `envconfig:"SERVER_SCRAPE_INTERVAL" required:"false" default:"30m"` - PackageSearchInterval time.Duration `envconfig:"PACKAGE_SEARCH_INTERVAL" required:"false" default:"24h"` - PackageScrapeInterval time.Duration `envconfig:"PACKAGE_SCRAPE_INTERVAL" required:"false" default:"24h"` + DatabaseURL string `envconfig:"DATABASE_URL" required:"true"` + ListenAddr string `envconfig:"LISTEN_ADDR" default:"0.0.0.0:8000"` + CookieDomain string `envconfig:"COOKIE_DOMAIN" default:".open.mp"` + PublicWebAddress string `envconfig:"PUBLIC_WEB_ADDRESS" default:"https://open.mp"` + LauncherBackendAddress string `envconfig:"LAUNCHER_BACKEND_ADDRESS" default:"http://localhost:1420"` + PublicApiAddress string `envconfig:"PUBLIC_API_ADDRESS" default:"https://api.open.mp"` + HashKey []byte `envconfig:"HASH_KEY" required:"true"` + BlockKey []byte `envconfig:"BLOCK_KEY" required:"true"` + GithubClientID string `envconfig:"GITHUB_CLIENT_ID" required:"true"` + GithubClientSecret string `envconfig:"GITHUB_CLIENT_SECRET" required:"true"` + DiscordClientID string `envconfig:"DISCORD_CLIENT_ID" required:"true"` + DiscordClientSecret string `envconfig:"DISCORD_CLIENT_SECRET" required:"true"` + GithubToken string `envconfig:"GITHUB_TOKEN" required:"true"` + DocsSourcesPath string `envconfig:"DOCS_SOURCES_PATH" required:"false" default:"docs/"` + DocsIndexPath string `envconfig:"DOCS_INDEX_PATH" required:"false" default:"docs.bleve"` + PackagesDB string `envconfig:"PACKAGES_DB" required:"false" default:"data/packages.db"` + CachedServers string `envconfig:"CACHED_SERVERS_FILE" required:"false" default:"data/cachedServers.json"` + ServerScrapeInterval time.Duration `envconfig:"SERVER_SCRAPE_INTERVAL" required:"false" default:"30m"` + PackageSearchInterval time.Duration `envconfig:"PACKAGE_SEARCH_INTERVAL" required:"false" default:"24h"` + PackageScrapeInterval time.Duration `envconfig:"PACKAGE_SCRAPE_INTERVAL" required:"false" default:"24h"` } func New() (c Config, err error) {