Skip to content

Commit a47b1e4

Browse files
authored
Merge pull request #2772 from codefori/fix/new_config_fallback
Fix fallback value and rename configuration reference
2 parents 5b634d1 + 001b3f3 commit a47b1e4

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/api/IBMi.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ interface ConnectionCallbacks {
6767
}
6868

6969
interface ConnectionConfigFiles {
70-
connection: ConfigFile<RemoteConfigFile>;
70+
settings: ConfigFile<RemoteConfigFile>;
7171
}
7272

7373
export default class IBMi {
@@ -88,7 +88,7 @@ export default class IBMi {
8888
private componentManager = new ComponentManager(this);
8989

9090
private configFiles: ConnectionConfigFiles = {
91-
connection: new ConfigFile<RemoteConfigFile>(this, `codefori`, {})
91+
settings: new ConfigFile<RemoteConfigFile>(this, `settings`, {})
9292
};
9393

9494
/**
@@ -506,7 +506,7 @@ export default class IBMi {
506506
callbacks.progress({ message: `Loading remote configuration files.` });
507507
await this.loadRemoteConfigs();
508508

509-
const remoteConnectionConfig = this.getConfigFile<RemoteConfigFile>(`connection`);
509+
const remoteConnectionConfig = this.getConfigFile<RemoteConfigFile>(`settings`);
510510
if (remoteConnectionConfig.getState().server === `ok`) {
511511
const remoteConfig = await remoteConnectionConfig.get();
512512

src/api/configuration/serverFile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class ConfigFile<T> {
6161
}
6262

6363
async get() {
64-
return this.serverData;
64+
return this.serverData || this.fallback;
6565
}
6666

6767
reset() {

src/webviews/settings/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ export class SettingsUI {
5050
// Reload config to initialize any new config parameters.
5151
config = await IBMi.connectionManager.load(connection.currentConnectionName);
5252

53-
const serverConfigOk = connection.getConfigFile(`connection`).getState().server === `ok`;
53+
const remoteConnectionConfig = connection.getConfigFile<RemoteConfigFile>(`settings`);
54+
const serverConfigOk = remoteConnectionConfig.getState().server === `ok`;
5455

5556
if (serverConfigOk) {
56-
serverConfig = await connection.getConfigFile<RemoteConfigFile>(`connection`).get();
57+
serverConfig = await remoteConnectionConfig.get();
5758
}
5859
} else {
5960
vscode.window.showErrorMessage(`No connection is active.`);

0 commit comments

Comments
 (0)