mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 07:04:53 +09:00
Log where Factorio credentials taken from
Provide ease of diagnosing credential issues by accurately logging if the credentials were sourced from the instance config, the host config, the controller config, or if no credentials were found.
This commit is contained in:
1 parent
f873f4b369
commit
a09a564358
1 file changed
+10
-1
@@ -589,16 +589,25 @@ rcon.print(game.table_to_json(players))`.replace(/\r?\n/g, " ");
|
||||
*/
|
||||
async resolveServerSettings(overrides: Record<string, unknown>, includeCredentials: boolean) {
|
||||
let serverSettings = await this.server.exampleSettings();
|
||||
if (includeCredentials && !overrides.username && !overrides.token) {
|
||||
if (includeCredentials && overrides.username === undefined && overrides.token === undefined) {
|
||||
let credentials = {
|
||||
username: this._host.config.get("host.factorio_username") ?? undefined,
|
||||
token: this._host.config.get("host.factorio_token") ?? undefined,
|
||||
};
|
||||
if (!credentials.username && !credentials.token) {
|
||||
Object.assign(credentials, await this.sendTo("controller", new lib.GetFactorioCredentialsRequest()));
|
||||
if (credentials.username || credentials.token) {
|
||||
this.logger.info("Using Factorio credentials from controller config");
|
||||
} else {
|
||||
this.logger.warn("No Factorio credentials found");
|
||||
}
|
||||
} else {
|
||||
this.logger.info("Using Factorio credentials from host config");
|
||||
}
|
||||
if (credentials.username) { serverSettings.username = credentials.username; }
|
||||
if (credentials.token) { serverSettings.token = credentials.token; }
|
||||
} else if (includeCredentials) {
|
||||
this.logger.info("Using Factorio credentials from instance config");
|
||||
}
|
||||
|
||||
for (let [key, value] of Object.entries(overrides)) {
|
||||
|
||||
Reference in new issue
Block a user