Skip to content

Commit

Permalink
chore: 3.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
null2264 committed Mar 16, 2023
1 parent 061cf35 commit 36f4ca9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
> previously functions and constants are all over the place that it's starting
> to get harder to find what I'm looking for.
## 3.6.1 (Project Structure Refactor - Part 1.5 A.K.A Hotfix)

- [**Fixed**] Fixed issues related to `import tse`
- [**Fixed**] Aerich caused the bot to crash in production environment

## 3.6.0 (Project Structure Refactor - Part 1)

### Bugfixes
Expand Down
2 changes: 1 addition & 1 deletion aerichConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
except ImportError:
dbUrl = os.environ["ZIBOT_DB_URL"]

cfg = Config("", dbUrl)
cfg = Config("", dbUrl, useAerich=True)
t = cfg.tortoiseConfig
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "Z3R0"
version = "3.6.0"
version = "3.6.1"
description = "A multi-purpose open source discord bot"
authors = ["null2264"]
license = "MPL-2.0"
Expand Down
10 changes: 8 additions & 2 deletions src/main/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Config:
"internalApiHost",
"test",
"zmqPorts",
"useAerich",
)

def __init__(
Expand All @@ -41,6 +42,7 @@ def __init__(
internalApiHost: str | None = None,
test: bool = False,
zmqPorts: dict[str, int] | None = None,
useAerich: bool = False,
):
self.token = token
self.defaultPrefix = defaultPrefix or ">"
Expand All @@ -54,19 +56,23 @@ def __init__(
self.internalApiHost = internalApiHost or "127.0.0.1:2264"
self.test = test
self.zmqPorts = zmqPorts or {}
self.useAerich = useAerich

@property
def tortoiseConfig(self):
mainModel = "main.core.db"
if not self.test:
mainModel = "src." + mainModel

models = [mainModel]
if self.useAerich:
models.append("aerich.models")

return self._tortoiseConfig or {
"connections": {"default": self.databaseUrl},
"apps": {
"models": {
# "models": [mainModel, "aerich.models"],
"models": [mainModel],
"models": models,
"default_connection": "default",
},
},
Expand Down

0 comments on commit 36f4ca9

Please sign in to comment.