Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

Commit

Permalink
Move default config to its file
Browse files Browse the repository at this point in the history
  • Loading branch information
2e3s committed Sep 3, 2019
1 parent 7e7612d commit b664942
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
33 changes: 3 additions & 30 deletions spytrack/config/config_storage.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,9 @@
import yaml
import argparse
import appdirs
from pathlib import Path
from config import Config, ConfigDict
import appdirs

default_config = """
daemon:
host: http://localhost
port: 9011
gui:
interval: 5
projects:
- name: coding
rules:
- app: pycharm
type: app
- title: Qt Designer
type: app
- type: web
url: .*qt.io.*
- type: web
url: python
- title: python
type: web
- title: pyqt
type: web
- app: code
title: .*Visual Studio Code
type: app
run_daemon: true
start_day_time: '5:00'
"""
from config.default_config import default_yaml


def get_config_file() -> Path:
Expand All @@ -57,7 +30,7 @@ def load(self) -> Config:
try:
if not self.file.exists():
self.file.parent.mkdir(parents=True, exist_ok=True)
values = yaml.safe_load(default_config)
values = yaml.safe_load(default_yaml)
self._persist(values)
else:
values = yaml.safe_load(self.file.read_text())
Expand Down
27 changes: 27 additions & 0 deletions spytrack/config/default_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
default_yaml = """
daemon:
host: http://localhost
port: 9011
gui:
interval: 5
projects:
- name: coding
rules:
- app: pycharm
type: app
- title: Qt Designer
type: app
- type: web
url: .*qt.io.*
- type: web
url: python
- title: python
type: web
- title: pyqt
type: web
- app: code
title: .*Visual Studio Code
type: app
run_daemon: true
start_day_time: '5:00'
"""

0 comments on commit b664942

Please sign in to comment.