Skip to content

Commit

Permalink
add launcher web engine address to cors origins
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyrAhmady committed Oct 5, 2023
1 parent f8810b9 commit 22c24b2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
5 changes: 3 additions & 2 deletions app/transports/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
11 changes: 6 additions & 5 deletions fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
39 changes: 20 additions & 19 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 22c24b2

Please sign in to comment.