diff --git a/app/appConfiguration/index.js b/app/appConfiguration/index.js
index c05ce23d..e5d03e69 100644
--- a/app/appConfiguration/index.js
+++ b/app/appConfiguration/index.js
@@ -14,10 +14,12 @@ class AppConfiguration {
_AppConfiguration_configPath.set(this, configPath);
_AppConfiguration_startupConfig.set(this, require('../config')(configPath, appVersion));
_AppConfiguration_legacyConfigStore.set(this, new Store({
- name: 'config'
+ name: 'config',
+ clearInvalidConfig: true
}));
_AppConfiguration_settingsStore.set(this, new Store({
- name: 'settings'
+ name: 'settings',
+ clearInvalidConfig: true
}));
}
diff --git a/app/config/index.js b/app/config/index.js
index 4d95316c..fb1581ef 100644
--- a/app/config/index.js
+++ b/app/config/index.js
@@ -1,21 +1,34 @@
const yargs = require('yargs');
+const fs = require('fs');
const path = require('path');
const { LucidLog } = require('lucid-log');
let logger;
+function getConfigFilePath(configPath) {
+ return path.join(configPath, 'config.json');
+}
+
+function checkConfigFileExistance(configPath) {
+ return fs.existsSync(getConfigFilePath(configPath));
+}
+
function getConfigFile(configPath) {
- return require(path.join(configPath, 'config.json'));
+ return require(getConfigFilePath(configPath));
}
function argv(configPath, appVersion) {
let configFile = null;
let configError = null;
- try {
- configFile = getConfigFile(configPath);
- } catch (e) {
- configError = e.message;
+
+ if (checkConfigFileExistance(configPath)) {
+ try {
+ configFile = getConfigFile(configPath);
+ } catch (e) {
+ configError = e.message;
+ }
}
+
const missingConfig = configFile == null;
configFile = configFile || {};
let config = yargs
@@ -279,7 +292,11 @@ function argv(configPath, appVersion) {
logger.debug('configPath:', configPath);
if (missingConfig) {
- logger.warn('No config file found, using default values');
+ if (configError) {
+ logger.warn('Error in config file, using default values:\n' + configError);
+ } else {
+ logger.warn('No config file found, using default values');
+ }
}
logger.debug('configFile:', configFile);
diff --git a/com.github.IsmaelMartinez.teams_for_linux.appdata.xml b/com.github.IsmaelMartinez.teams_for_linux.appdata.xml
index 7d72b73f..a1e4de37 100644
--- a/com.github.IsmaelMartinez.teams_for_linux.appdata.xml
+++ b/com.github.IsmaelMartinez.teams_for_linux.appdata.xml
@@ -14,11 +14,18 @@
https://github.com/IsmaelMartinez/teams-for-linux/issues
com.github.IsmaelMartinez.teams_for_linux.desktop
+
+
+
+ - Don't show error in case of missing config file.
+
+
+
- Show error message if configuration is invalid
-
+
diff --git a/package.json b/package.json
index fe62be11..e4dbece0 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "teams-for-linux",
- "version": "1.4.38",
+ "version": "1.4.39",
"main": "app/index.js",
"description": "Unofficial client for Microsoft Teams for Linux",
"homepage": "https://github.com/IsmaelMartinez/teams-for-linux",