Skip to content

Commit

Permalink
feat: allow ~ and env variables when adding source
Browse files Browse the repository at this point in the history
  • Loading branch information
Crissium committed Jan 30, 2024
1 parent 935860e commit 14019ed
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ def group_valid(self, group: 'dict[str, str | set[str]]') -> 'bool':
and all(lang in self.LANGS for lang in group['lang'])

def source_valid(self, source: 'str') -> 'bool':
source = self.parse_path_with_env_variables(source)
if os.path.isfile(source):
return False
elif os.path.isdir(source):
Expand Down Expand Up @@ -550,6 +551,7 @@ def dictionary_is_in_group(self, dictionary_name: 'str', group_name: 'str') -> '

def add_source(self, source: 'str') -> 'None':
if not source in self.misc_configs['sources']:
source = self.parse_path_with_env_variables(source)
self.misc_configs['sources'].append(source)
self._save_misc_configs()
logger.info(f'New source {source} added.')
Expand Down

0 comments on commit 14019ed

Please sign in to comment.