fromEnvironment static method

SetonixConfig fromEnvironment()

Implementation

static SetonixConfig fromEnvironment() {
  return SetonixConfig(
    host: bool.hasEnvironment(envHost)
        ? String.fromEnvironment(envHost, defaultValue: defaultHost)
        : null,
    port: bool.hasEnvironment(envPort)
        ? int.fromEnvironment(envPort, defaultValue: defaultPort)
        : null,
    worldFile: bool.hasEnvironment(envWorldFile)
        ? String.fromEnvironment(envWorldFile, defaultValue: defaultWorldName)
        : null,
    autosave: bool.hasEnvironment(envAutosave)
        ? bool.fromEnvironment(envAutosave, defaultValue: defaultAutosave)
        : null,
    multiWorld: bool.hasEnvironment(envMultiWorld)
        ? bool.fromEnvironment(envMultiWorld, defaultValue: defaultMultiWorld)
        : null,
    maxPlayers: bool.hasEnvironment(envMaxPlayers)
        ? int.fromEnvironment(envMaxPlayers, defaultValue: defaultMaxPlayers)
        : null,
    description: bool.hasEnvironment(envDescription)
        ? String.fromEnvironment(
            envDescription,
            defaultValue: defaultDescription,
          )
        : null,
    guestPrefix: bool.hasEnvironment(envGuestPrefix)
        ? String.fromEnvironment(
            envGuestPrefix,
            defaultValue: defaultGuestPrefix,
          )
        : null,
    whitelistEnabled: bool.hasEnvironment(envWhitelistEnabled)
        ? bool.fromEnvironment(
            envWhitelistEnabled,
            defaultValue: defaultWhitelistEnabled,
          )
        : null,
    accountRequired: bool.hasEnvironment(envAccountRequired)
        ? bool.fromEnvironment(
            envAccountRequired,
            defaultValue: defaultAccountRequired,
          )
        : null,
    apiEndpoint: bool.hasEnvironment(envApiEndpoint)
        ? String.fromEnvironment(
            envApiEndpoint,
            defaultValue: defaultApiEndpoint,
          )
        : null,
    endpointSecret: bool.hasEnvironment(envEndpointSecret)
        ? String.fromEnvironment(
            envEndpointSecret,
            defaultValue: defaultEndpointSecret,
          )
        : null,
  );
}