Take Two: The word filter now verbosely describes config failure (Rust-g 1.0.2 Edition) (#68690)

A resuscitation of #67474 since Arm is not presently able to do it.

rustg_read_toml_file has backwards dependency to support older cases that checked for lack of list (the old sign the rust fn went wrong).

Fixes #67446

The configuration for the word filter now verbosely describes the error from the bad toml to the logs, allowing problems with it to be identified quicker and resolved.
Why It's Good For The Game

BLAZING
Ferris warning
Changelog

cl Armhulen/Armhulenn/Bazelart/Tralezab, san7890
admin: Word filters incorrectly set up will now have their errors actually described. Please, tell your server ops when you see it so they may fix the configuration.
server: Rust-g on this codebase is now on the 1.0.2 version, prepare accordingly.
/cl

I also bump rust-g's DLL to 1.0.2 in this PR as well.
This commit is contained in:
san7890
2022-07-31 14:20:42 -06:00
committed by GitHub
parent 3292cae2cf
commit 1e540f3286
4 changed files with 13 additions and 6 deletions

View File

@@ -151,7 +151,14 @@
#define rustg_time_milliseconds(id) text2num(call(RUST_G, "time_milliseconds")(id))
#define rustg_time_reset(id) call(RUST_G, "time_reset")(id)
#define rustg_read_toml_file(path) json_decode(call(RUST_G, "toml_file_to_json")(path) || "null")
#define rustg_raw_read_toml_file(path) json_decode(call(RUST_G, "toml_file_to_json")(path) || "null")
/proc/rustg_read_toml_file(path)
var/list/output = rustg_raw_read_toml_file(path)
if (output["success"])
return json_decode(output["content"])
else
CRASH(output["content"])
#define rustg_url_encode(text) call(RUST_G, "url_encode")("[text]")
#define rustg_url_decode(text) call(RUST_G, "url_decode")(text)

View File

@@ -379,13 +379,13 @@ Example config:
return
log_config("Loading config file word_filter.toml...")
var/list/word_filter = rustg_read_toml_file("[directory]/word_filter.toml")
if (!islist(word_filter))
var/message = "The word filter configuration did not output a list, contact someone with configuration access to make sure it's setup properly."
var/list/result = rustg_read_toml_file("[directory]/word_filter.toml")
if(!result["success"])
var/message = "The word filter is not configured correctly! [result["content"]]"
log_config(message)
DelayedMessageAdmins(message)
return
var/list/word_filter = result["content"]
ic_filter_reasons = try_extract_from_word_filter(word_filter, "ic")
ic_outside_pda_filter_reasons = try_extract_from_word_filter(word_filter, "ic_outside_pda")

View File

@@ -8,7 +8,7 @@ export BYOND_MAJOR=514
export BYOND_MINOR=1560
#rust_g git tag
export RUST_G_VERSION=0.5.0
export RUST_G_VERSION=1.0.2
#node version
export NODE_VERSION=14

Binary file not shown.