-
Notifications
You must be signed in to change notification settings - Fork 23
Plugin web configs
Shine can load configs for plugins from your webserver, providing your web server responses follow a set of rules.
When loading fails for one or more plugins, they are loaded from either the hard drive cached file, or from the default config if no cache file exists.
On a successful web load (or reload), the web config data is cached to disk so that subsequent failures do not cause it to revert to the default config.
Firstly, you'll need to configure the settings for loading web plugin configs in the BaseConfig.json file.
"WebConfigs": {
"Enabled": true,
"RequestURL": "http://www.yourawesomesite.com/shine/configs.php",
"RequestArguments": { "bleh": "stuff" },
"MaxAttempts": 3,
"IsBlacklist": false,
"Plugins": { "afkkick": true, "basecommands": true },
"UpdateMode": 1,
"UpdateInterval": 1
},
Option | Description |
---|---|
Enabled | Sets if Shine should load certain plugin configs from your web server. |
RequestURL | Sets the URL to request the configs from. |
RequestArguments | Sets custom arguments to send with the POST request, i.e authentication key. |
MaxAttempts | Sets how many attempts to retrieve the configs should be made before giving up. |
IsBlacklist | Sets whether the "Plugins" list is a blacklist of plugins not to retrieve configs for, or a whitelist of plugins to retrieve configs for. Generally, a whitelist is better. |
UpdateMode | Sets how the configs should be updated. 1 means only load them on map load, 2 means load them on map load, and then in regular intervals. |
UpdateInterval | If "UpdateMode" is 2, then this is the time, in minutes, between timed updates. |
Your web server needs to respond in a particular way to be able to use this feature.
Shine will send your web server the following:
http://www.yourawesomesite.com/shine/configs.php?plugins={JSON array of plugin names}&gamemode={current running gamemode, usually "ns2"}&yourextrakeys=stuff
In response, Shine expects the following JSON data:
For a successful response:
{
"success": true,
"plugins": {
"afkkick": {
"success": true,
"config": {
"Config": "here"
}
},
"basecommands": {
"success": true,
"config": {
"Config": "here"
}
}
}
}
For a global failure:
{
"success": false,
"msg": "Permission denied."
}
For an individual plugin failure:
{
"success": true,
"plugins": {
"afkkick": {
"success": true,
"config": {
"Config": "here"
}
},
"basecommands": {
"success": false,
"msg": "No config stored."
}
}
}
If you want one or more of your plugins to respond with gamemode specific configs (which will be cached in the extensiondir/gamemodename folder), you simply need to add the "gamemode" field to the plugin's response table.
For example:
{
"success": true,
"plugins": {
"afkkick": {
"success": true,
"config": {
"Config": "here"
}
},
"basecommands": {
"success": true,
"config": {
"Config": "here"
},
"gamemode": "factions"
}
}
}