Example #1
0
def get_current_settings(curPath):
    baseConfig = {
        "/Script/Astro.AstroServerSettings": {
            "bLoadAutoSave": "True",
            "MaxServerFramerate": "30.000000",
            "MaxServerIdleFramerate": "3.000000",
            "bWaitForPlayersBeforeShutdown": "False",
            "PublicIP": get_public_ip(),
            "ServerName": "Astroneer Dedicated Server",
            "MaximumPlayerCount": "12",
            "OwnerName": "",
            "OwnerGuid": "",
            "PlayerActivityTimeout": "0",
            "ServerPassword": "",
            "bDisableServerTravel": "False",
            "DenyUnlistedPlayers": "False",
            "VerbosePlayerProperties": "True",
            "AutoSaveGameInterval": "900",
            "BackupSaveGamesInterval": "7200",
            "ServerGuid": uuid.uuid4().hex,
            "ActiveSaveFileDescriptiveName": "SAVE_1",
            "ServerAdvertisedName": "",
            "ConsolePort": "1234"
        }
    }
    config = MultiConfig().baseline(
        os.path.join(
            curPath,
            r"Astro\Saved\Config\WindowsServer\AstroServerSettings.ini"),
        baseConfig)

    settings = config.getdict()['/Script/Astro.AstroServerSettings']

    baseConfig = {
        "URL": {
            "Port": "7777"
        },
        "/Script/OnlineSubsystemUtils.IpNetDriver": {
            "MaxClientRate": "1000000",
            "MaxInternetClientRate": "1000000"
        }
    }
    config = MultiConfig().baseline(
        os.path.join(curPath, r"Astro\Saved\Config\WindowsServer\Engine.ini"),
        baseConfig)
    # print(settings)
    settings.update(config.getdict()['URL'])
    # print(settings)
    return settings