mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-19 00:23:05 +00:00
create discord login button & flow
This commit is contained in:
@@ -24,6 +24,7 @@ import { UserSettings } from "../game/UserSettings";
|
||||
|
||||
export enum GameEnv {
|
||||
Dev,
|
||||
Preprod,
|
||||
Prod,
|
||||
}
|
||||
export function getConfig(
|
||||
@@ -64,6 +65,8 @@ export interface ServerConfig {
|
||||
turnIntervalMs(): number;
|
||||
gameCreationRate(): number;
|
||||
lobbyLifetime(): number;
|
||||
discordRedirectURI(): string;
|
||||
env(): GameEnv;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
|
||||
@@ -19,10 +19,12 @@ import { PlayerView } from "../game/GameView";
|
||||
import { UserSettings } from "../game/UserSettings";
|
||||
import { GameConfig } from "../Schemas";
|
||||
import { assertNever, within } from "../Util";
|
||||
import { Config, ServerConfig, Theme } from "./Config";
|
||||
import { Config, GameEnv, ServerConfig, Theme } from "./Config";
|
||||
import { pastelTheme } from "./PastelTheme";
|
||||
|
||||
export abstract class DefaultServerConfig implements ServerConfig {
|
||||
abstract env(): GameEnv;
|
||||
abstract discordRedirectURI(): string;
|
||||
turnIntervalMs(): number {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,24 @@
|
||||
import { GameType, Player, PlayerInfo, UnitInfo, UnitType } from "../game/Game";
|
||||
import { UserSettings } from "../game/UserSettings";
|
||||
import { GameConfig } from "../Schemas";
|
||||
import { ServerConfig } from "./Config";
|
||||
import { GameEnv, ServerConfig } from "./Config";
|
||||
import { DefaultConfig, DefaultServerConfig } from "./DefaultConfig";
|
||||
|
||||
export class DevServerConfig extends DefaultServerConfig {
|
||||
env(): GameEnv {
|
||||
return GameEnv.Dev;
|
||||
}
|
||||
gameCreationRate(): number {
|
||||
return 10 * 1000;
|
||||
}
|
||||
|
||||
lobbyLifetime(): number {
|
||||
return 10 * 1000;
|
||||
}
|
||||
|
||||
discordRedirectURI(): string {
|
||||
return "http://localhost:3000/auth/callback";
|
||||
}
|
||||
}
|
||||
|
||||
export class DevConfig extends DefaultConfig {
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
import { GameEnv } from "./Config";
|
||||
import { DefaultConfig, DefaultServerConfig } from "./DefaultConfig";
|
||||
|
||||
export const preprodConfig = new (class extends DefaultServerConfig {})();
|
||||
export const preprodConfig = new (class extends DefaultServerConfig {
|
||||
env(): GameEnv {
|
||||
return GameEnv.Preprod;
|
||||
}
|
||||
discordRedirectURI(): string {
|
||||
return "https://openfront.dev/auth/callback";
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
import { GameEnv } from "./Config";
|
||||
import { DefaultConfig, DefaultServerConfig } from "./DefaultConfig";
|
||||
|
||||
export const prodConfig = new (class extends DefaultServerConfig {})();
|
||||
export const prodConfig = new (class extends DefaultServerConfig {
|
||||
env(): GameEnv {
|
||||
return GameEnv.Prod;
|
||||
}
|
||||
discordRedirectURI(): string {
|
||||
return "https://openfront.io/auth/callback";
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user