Skip to content

Commit

Permalink
Reverts the recent config changes (#56606)
Browse files Browse the repository at this point in the history
* Revert "Fixes included config files not loading (#56602)"

This reverts commit 0749b32.

* Revert "Adds configuration consistency tests (#56562)"

This reverts commit 4f44014.
  • Loading branch information
LemonInTheDark authored Feb 3, 2021
1 parent ef73b28 commit dd6cea8
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 176 deletions.
6 changes: 0 additions & 6 deletions code/__DEFINES/configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,3 @@
#define CONFIG_ENTRY_LOCKED 1
/// can't see value
#define CONFIG_ENTRY_HIDDEN 2

/// The main configuration .txt file loaded
#define DEFAULT_CONFIGURATION_FILE "config.txt"

/// The token used to include other config files
#define CONFIGURATION_INCLUDE_TOKEN "$include"
76 changes: 17 additions & 59 deletions code/controllers/configuration/configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
CRASH("/datum/controller/configuration/Load() called more than once!")
InitEntries()
LoadModes()
if(fexists("[directory]/[DEFAULT_CONFIGURATION_FILE]") && LoadEntries(DEFAULT_CONFIGURATION_FILE) <= 1)
if(fexists("[directory]/config.txt") && LoadEntries("config.txt") <= 1)
var/list/legacy_configs = list("game_options.txt", "dbconfig.txt", "comms.txt")
for(var/I in legacy_configs)
if(fexists("[directory]/[I]"))
log_config("No [CONFIGURATION_INCLUDE_TOKEN] directives found in [DEFAULT_CONFIGURATION_FILE]! Loading legacy [legacy_configs.Join("/")] files...")
log_config("No $include directives found in config.txt! Loading legacy [legacy_configs.Join("/")] files...")
for(var/J in legacy_configs)
LoadEntries(J)
break
Expand Down Expand Up @@ -101,39 +101,27 @@
entries -= CE.name
entries_by_type -= CE.type

/****
* Breaks up a file into an associated list of lowercase entries and their values. The null entry represents a nested list of entries that are commented out
* filename - The filename in directory to load
*/
/datum/controller/configuration/proc/ParseConfigFile(filename)
/datum/controller/configuration/proc/LoadEntries(filename, list/stack = list())
if(IsAdminAdvancedProcCall())
return

if(world.system_type == MS_WINDOWS)
filename = lowertext(filename)
var/filename_to_test = world.system_type == MS_WINDOWS ? lowertext(filename) : filename
if(filename_to_test in stack)
log_config("Warning: Config recursion detected ([english_list(stack)]), breaking!")
return
stack = stack + filename_to_test

log_config("Loading config file [filename]...")
var/list/lines = world.file2list("[directory]/[filename]")
var/list/results = list()
if(!lines.len) //Good job 4head you loaded a file that doesn't exist or doesn't contain anything in it
log_config("Error: We tried to load [directory]/[filename] but it doesn't have anything in it/it doesn't exist!")
CRASH("Error: We tried to load [directory]/[filename] but it doesn't have anything in it/it doesn't exist!")
var/list/_entries = entries
for(var/L in lines)
L = trim(L)
if(!L)
continue

var/firstchar = L[1]
var/disabled = FALSE
if(firstchar == "#")
if(length(L) > 1 && L[2] == "#")
// comment
continue

// disabled entry
disabled = TRUE
L = trim(copytext(L, 2, length(L) + 1))
firstchar = L[1]
continue

var/lockthis = firstchar == "@"
if(lockthis)
Expand All @@ -152,45 +140,15 @@
if(!entry)
continue

if(disabled)
LAZYADD(results[null], entry)
else if(entry == CONFIGURATION_INCLUDE_TOKEN)
LAZYADD(results[entry], value)
else
results[entry] = value

return results

///Takes the file name to load and a list of already loaded files as an argument, returns the amount of files loaded
/datum/controller/configuration/proc/LoadEntries(filename, list/stack = list())
if(IsAdminAdvancedProcCall())
return

var/filename_to_test = world.system_type == MS_WINDOWS ? lowertext(filename) : filename
if(filename_to_test in stack)
log_config("Warning: Config recursion detected ([english_list(stack)]), breaking!")
return
stack += filename_to_test

var/list/parsed_entries = ParseConfigFile(filename_to_test)
// Don't care about disabled entries here
parsed_entries -= null
for(var/entry in parsed_entries)
var/value = parsed_entries[entry]
if(entry == CONFIGURATION_INCLUDE_TOKEN)
for(var/includedfile in value) //Value is a list of included files in this case
if(!includedfile)
log_config("Warning: Invalid $include directive: [includedfile]")
else
. += LoadEntries(includedfile, stack)
if(entry == "$include")
if(!value)
log_config("Warning: Invalid $include directive: [value]")
else
LoadEntries(value, stack)
++.
continue

var/firstchar = entry[1]
var/lockthis = firstchar == "@"
if(lockthis)
entry = copytext(entry, length(firstchar) + 1)

var/datum/config_entry/E = entries[entry]
var/datum/config_entry/E = _entries[entry]
if(!E)
log_config("Unknown setting in configuration: '[entry]'")
continue
Expand Down
1 change: 0 additions & 1 deletion code/modules/unit_tests/_unit_tests.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "chain_pull_through_space.dm"
#include "combat.dm"
#include "component_tests.dm"
#include "configuration_documentation.dm"
#include "confusion.dm"
#include "designs.dm"
#include "emoting.dm"
Expand Down
63 changes: 0 additions & 63 deletions code/modules/unit_tests/configuration_documentation.dm

This file was deleted.

6 changes: 3 additions & 3 deletions config/antag_rep.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Custom antag reputation values
## List of job titles followed by antag rep value, all prefixed with ANTAG_REP. See code/modules/jobs/job_types for titles
## e.g.
# ANTAG_REP Captain 10
# ANTAG_REP Assistant 0
## e.g.
## ANTAG_REP Captain 10
## ANTAG_REP Assistant 0
38 changes: 24 additions & 14 deletions config/config.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## You can use the "$include" directive to split your configs however you want
# You can use the "$include" directive to split your configs however you want

$include game_options.txt
$include dbconfig.txt
Expand All @@ -7,13 +7,13 @@ $include antag_rep.txt
$include resources.txt
$include interviews.txt

## You can use the @ character at the beginning of a config option to lock it from being edited in-game
## Example usage:
## @SERVERNAME tgstation
## Which sets the SERVERNAME, and disallows admins from being able to change it using View Variables.
## @LOG_TWITTER 0
## Which explicitly disables LOG_TWITTER, as well as locking it.
## There are various options which are hard-locked for security reasons.
# You can use the @ character at the beginning of a config option to lock it from being edited in-game
# Example usage:
# @SERVERNAME tgstation
# Which sets the SERVERNAME, and disallows admins from being able to change it using View Variables.
# @LOG_TWITTER 0
# Which explicitly disables LOG_TWITTER, as well as locking it.
# There are various options which are hard-locked for security reasons.

## Server name: This appears at the top of the screen in-game and in the BYOND hub. Uncomment and replace 'tgstation' with the name of your choice.
# SERVERNAME tgstation
Expand All @@ -27,9 +27,6 @@ STATIONNAME Space Station 13
## Put on byond hub: Uncomment this to put your server on the byond hub.
#HUB

## Once the server population reaches this number, it will be taken off the byond hub. 0 disables.
#MAX_HUB_POP 100

## Lobby time: This is the amount of time between rounds that players have to setup their characters and be ready.
LOBBY_COUNTDOWN 120

Expand Down Expand Up @@ -402,9 +399,6 @@ AUTOADMIN_RANK Game Master
## Uncomment to automatically deadmin players when the game starts.
#AUTO_DEADMIN_PLAYERS

## Number of game ticks before player-admins will be automatically deadminned.
#AUTO_DEADMIN_TIMEGATE 600

## Uncomment to automatically deadmin antagonists when they gain the role.
#AUTO_DEADMIN_ANTAGONISTS

Expand Down Expand Up @@ -522,3 +516,19 @@ DEFAULT_VIEW_SQUARE 15x15
## Uncomment to enable source whitelisting, a comma-separated list (no spaces) of CentCom sources (sourceName).
## If enabled, only bans from these servers will be shown to admins using CentCom. The default sources list is an example.
#CENTCOM_SOURCE_WHITELIST Beestation MRP,TGMC,FTL13

#### DISCORD STUFFS ####
## MAKE SURE ALL SECTIONS OF THIS ARE FILLED OUT BEFORE ENABLING
## Discord IDs can be obtained by following this guide: https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-

## Uncomment to enable discord auto-roling when users link their BYOND and Discord accounts
#ENABLE_DISCORD_AUTOROLE

## Add your discord bot token here. Make sure it has the ability to manage roles
#DISCORD_TOKEN someDiscordToken

## Add the ID of your guild (server) here
#DISCORD_GUILDID 000000000000000000

## Add the ID of the role you want assigning here
#DISCORD_ROLEID 000000000000000000
3 changes: 1 addition & 2 deletions config/game_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ EMOJIS

## HEART COMMENDATIONS ###
## Uncomment this if you'd like to enable commendation pollings for this percentage of players near the end of the round (5% default)
#COMMENDATIONS 0.05
## COMMENDATIONS 0.05

## MOB MOVEMENT ###

Expand Down Expand Up @@ -199,7 +199,6 @@ SHUTTLE_REFUEL_DELAY 12000
TRAITOR_SCALING_COEFF 6
BROTHER_SCALING_COEFF 6
CHANGELING_SCALING_COEFF 6
ECULT_SCALING_COEFF 6

## Variables calculate how number of open security officer positions will scale to population.
## Used as (Officers = Population / Coeff)
Expand Down
6 changes: 3 additions & 3 deletions config/interviews.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Interview welcome message displayed at the top of all interview questionnaires
## Should help to describe why the questionnaire is being given to the interviewee
# Interview welcome message displayed at the top of all interview questionnaires
# Should help to describe why the questionnaire is being given to the interviewee
INTERVIEW_WELCOME_MSG Welcome to our server. As you have not played here before, or played very little, we'll need you to answer a few questions below. After you submit your answers they will be reviewed and you may be asked further questions before being allowed to play. Please be patient as there may be others ahead of you.

## Interview questions are listed here, in the order that they will be displayed in-game.
# Interview questions are listed here, in the order that they will be displayed in-game.
INTERVIEW_QUESTIONS Why have you joined the server today?
INTERVIEW_QUESTIONS Have you played space-station 13 before? If so, on what servers?
INTERVIEW_QUESTIONS Do you know anybody on the server today? If so, who?
Expand Down
44 changes: 22 additions & 22 deletions config/resources.txt
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
## External resources
## Set this to the location of a .zip with the server's .rsc inside of it.
## If you set this mutiple times, the server will rotate between the links.
## To use this, the compile option PRELOAD_RSC must be set to 0 to keep byond from preloading resources
## Resource urls can not be encrypted (https://), as they are downloaded by byond, not IE, and byond can't into encryption
# External resources
# Set this to the location of a .zip with the server's .rsc inside of it.
# If you set this mutiple times, the server will rotate between the links.
# To use this, the compile option PRELOAD_RSC must be set to 0 to keep byond from preloading resources
# Resource urls can not be encrypted (https://), as they are downloaded by byond, not IE, and byond can't into encryption

EXTERNAL_RSC_URLS http://tgstation13.download/byond/tgstationv2.zip


########################
## Browser Asset Config #
# Browser Asset Config #
########################
## Browser assets are any file included in interfaces. css, images, javascript, etc.
## This handles configuring how we get these to the player so interfaces can access them.
# Browser assets are any file included in interfaces. css, images, javascript, etc.
# This handles configuring how we get these to the player so interfaces can access them.

## Asset Transport
## The normal way of getting assets to clients is to use the internal byond system. This can be slow and delay the opening of interface windows. It also doesn't allow the internal IE windows byond uses to cache anything.
## You can instead have the server save them to a website via a folder within the game server that the web server can read. This could be a simple webserver or something backed by a CDN.
## Valid values: simple, webroot. Simple is the default.
# Asset Transport
# The normal way of getting assets to clients is to use the internal byond system. This can be slow and delay the opening of interface windows. It also doesn't allow the internal IE windows byond uses to cache anything.
# You can instead have the server save them to a website via a folder within the game server that the web server can read. This could be a simple webserver or something backed by a CDN.
# Valid values: simple, webroot. Simple is the default.
#ASSET_TRANSPORT webroot


## Simple asset transport configurable values.
# Simple asset transport configurable values.

## Uncomment this to have the server passively send all browser assets to each client in the background. (instead of waiting for them to be needed)
## This should be uncommented in production and commented in development
# Uncomment this to have the server passively send all browser assets to each client in the background. (instead of waiting for them to be needed)
# This should be uncommented in production and commented in development
#ASSET_SIMPLE_PRELOAD


## Webroot asset transport configurable values.
# Webroot asset transport configurable values.

## Local folder to save assets to.
## Assets will be saved in the format of asset.MD5HASH.EXT or in namespaces/hash/ as ASSET_FILE_NAME or asset.MD5HASH.EXT
# Local folder to save assets to.
# Assets will be saved in the format of asset.MD5HASH.EXT or in namespaces/hash/ as ASSET_FILE_NAME or asset.MD5HASH.EXT
#ASSET_CDN_WEBROOT data/asset-store/

## URL the folder from above can be accessed from.
## for best results the webserver powering this should return a long cache validity time, as all assets sent via this transport use hash based urls
## Encryption (https) is supported here, but linux clients will have issues if you require higher then tls 1.0. Windows clients down to windows 7 can handle tls 1.2 no issue.
## if you want to test this locally, you simpily run the `localhost-asset-webroot-server.py` python3 script to host assets stored in `data/asset-store/` via http://localhost:58715/
# URL the folder from above can be accessed from.
# for best results the webserver powering this should return a long cache validity time, as all assets sent via this transport use hash based urls
# Encryption (https) is supported here, but linux clients will have issues if you require higher then tls 1.0. Windows clients down to windows 7 can handle tls 1.2 no issue.
# if you want to test this locally, you simpily run the `localhost-asset-webroot-server.py` python3 script to host assets stored in `data/asset-store/` via http://localhost:58715/
#ASSET_CDN_URL http://localhost:58715/

4 changes: 1 addition & 3 deletions tools/ci/run_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ tools/deploy.sh ci_test
mkdir ci_test/config

#test config
cp -r config/* ci_test/config/
mv ci_test/config/config.txt ci_test/config/original_config.txt
cp tools/ci/ci_config.txt ci_test/config/config.txt

cd ci_test
DreamDaemon tgstation.dmb -close -trusted -verbose -params "log-directory=ci&original_config=original_config.txt"
DreamDaemon tgstation.dmb -close -trusted -verbose -params "log-directory=ci"
cd ..
cat ci_test/data/logs/ci/clean_run.lk

0 comments on commit dd6cea8

Please sign in to comment.