mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 11:38:32 +02:00
Added check for empty config file and if so, use default config
This commit is contained in:
parent
602dad7e06
commit
ca96e3175e
2 changed files with 11 additions and 1 deletions
|
@ -75,6 +75,12 @@ def load_or_install_jrnl(alt_config_path):
|
|||
logging.debug("Reading configuration from file %s", config_path)
|
||||
config = load_config(config_path)
|
||||
|
||||
if config is None:
|
||||
print(
|
||||
f"Configuration file {config_path} is empty, now using default config"
|
||||
)
|
||||
config = get_default_config()
|
||||
|
||||
if is_old_version(config_path):
|
||||
from jrnl import upgrade
|
||||
|
||||
|
|
|
@ -85,7 +85,6 @@ Feature: Multiple journals
|
|||
Then the output should contain "Journal encrypted to features/journals/basic_onefile.journal"
|
||||
And the config should contain "encrypt: false"
|
||||
|
||||
|
||||
Scenario: Don't overwrite main config when decrypting a journal in an alternate config
|
||||
Given the config "editor_encrypted.yaml" exists
|
||||
And we use the password "bad doggie no biscuit" if prompted
|
||||
|
@ -93,3 +92,8 @@ Feature: Multiple journals
|
|||
When we run "jrnl --cf editor_encrypted.yaml --decrypt"
|
||||
Then the config should contain "encrypt: true"
|
||||
And the output should not contain "Wrong password"
|
||||
|
||||
Scenario: Use default config when configuration file is empty or corrupt
|
||||
Given the config "empty_file.yaml" exists
|
||||
When we run "jrnl --cf empty_file.yaml"
|
||||
Then the output should contain "empty, now using default config"
|
Loading…
Add table
Reference in a new issue