Even more defense - only matchy knows about the state.json path
This commit is contained in:
parent
57f65b265c
commit
9337b92f50
2 changed files with 3 additions and 6 deletions
|
@ -9,7 +9,8 @@ from state import load_from_file
|
||||||
from cogs.matchy_cog import MatchyCog
|
from cogs.matchy_cog import MatchyCog
|
||||||
from cogs.owner_cog import OwnerCog
|
from cogs.owner_cog import OwnerCog
|
||||||
|
|
||||||
state = load_from_file()
|
_STATE_FILE = "state.json"
|
||||||
|
state = load_from_file(_STATE_FILE)
|
||||||
|
|
||||||
logger = logging.getLogger("matchy")
|
logger = logging.getLogger("matchy")
|
||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(logging.INFO)
|
||||||
|
|
|
@ -13,10 +13,6 @@ logger = logging.getLogger("state")
|
||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(logging.INFO)
|
||||||
|
|
||||||
|
|
||||||
# Location of the default state file
|
|
||||||
_STATE_FILE = "state.json"
|
|
||||||
|
|
||||||
|
|
||||||
# Warning: Changing any of the below needs proper thought to ensure backwards compatibility
|
# Warning: Changing any of the below needs proper thought to ensure backwards compatibility
|
||||||
_VERSION = 4
|
_VERSION = 4
|
||||||
|
|
||||||
|
@ -385,7 +381,7 @@ def _migrate(dict: dict):
|
||||||
dict[_Key.VERSION] = _VERSION
|
dict[_Key.VERSION] = _VERSION
|
||||||
|
|
||||||
|
|
||||||
def load_from_file(file: str = _STATE_FILE) -> State:
|
def load_from_file(file: str) -> State:
|
||||||
"""
|
"""
|
||||||
Load the state from a files
|
Load the state from a files
|
||||||
Apply any required migrations
|
Apply any required migrations
|
||||||
|
|
Loading…
Add table
Reference in a new issue