feat(bridge): server id from the environment, and the first release workflow (phase 18)
All checks were successful
PR Checks / plugin-checks (pull_request) Successful in -1m35s
All checks were successful
PR Checks / plugin-checks (pull_request) Successful in -1m35s
Module-rust phase 18, step 3 of docs/modules/rust/PLAN.md §34.2.7.
The environment seam (D150): when the plugin writes its default config and
RUSTLINK_SERVER_ID holds a valid id (the site's ^[a-z0-9][a-z0-9-]{0,63}$),
the file's ServerId is that value. It is read nowhere else: after that write
the file is canonical and the site's lock applies. An invalid value is logged
and ignored. This is how the egg names a server; not a message change, so the
protocol stays at 12.
The release (D145, §34.2.1): release.yml reuses servuo-plugins' release engine
unchanged (tag-only, secrets preflighted, orphan tags recovered and swept, the
installer's bundle.yml dispatched at the end). The adapter re-runs
checkPlugin.js and packages runicgateway-rust-plugin-<version>.tar.gz with a
framework-neutral layout: RunicGateway.cs, its [Info] version stamped to the
release, and a manifest.json folding in overlay.toml.
overlay.toml gains min_carbon_version = "2.0.259", the build R19 was proven on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -413,9 +413,47 @@ namespace Oxide.Plugins
|
||||
public int MapMaxBases = MapDefaultMax;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs only when this plugin has no config file yet — so it is the one moment a server id
|
||||
/// can arrive from outside the file (D150). A Pterodactyl egg cannot write a framework's
|
||||
/// config directory (Carbon lets an operator move it), but it can set an environment
|
||||
/// variable, and `RUSTLINK_SERVER_ID` is the one the sidecar already reads for its
|
||||
/// cross-check. After this write the file is canonical and the website's lock applies,
|
||||
/// so changing the variable later changes nothing — which is what keeps a server's
|
||||
/// history attached to one id.
|
||||
/// </summary>
|
||||
protected override void LoadDefaultConfig()
|
||||
{
|
||||
Config.WriteObject(new PluginConfig(), true);
|
||||
var config = new PluginConfig();
|
||||
|
||||
string fromEnv = Environment.GetEnvironmentVariable("RUSTLINK_SERVER_ID");
|
||||
if (!string.IsNullOrEmpty(fromEnv))
|
||||
{
|
||||
if (IsValidServerId(fromEnv))
|
||||
config.ServerId = fromEnv;
|
||||
else
|
||||
PrintWarning($"RUSTLINK_SERVER_ID '{fromEnv}' is not a valid server id " +
|
||||
$"(lowercase letters, digits and '-', 1-64, not starting with '-'); " +
|
||||
$"the new config keeps '{config.ServerId}'");
|
||||
}
|
||||
|
||||
Config.WriteObject(config, true);
|
||||
}
|
||||
|
||||
/// <summary>The website's rule for a server id, `^[a-z0-9][a-z0-9-]{0,63}$`, without a Regex.</summary>
|
||||
private static bool IsValidServerId(string id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id) || id.Length > 64 || id[0] == '-')
|
||||
return false;
|
||||
|
||||
foreach (char c in id)
|
||||
{
|
||||
bool ok = (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '-';
|
||||
if (!ok)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void LoadConfigValues()
|
||||
|
||||
Reference in New Issue
Block a user