cleaned up api
This commit is contained in:
1 parent
f8e615304c
commit
25e65540e1
5 files changed
+7
-8
No files matched your search
+1
-1
@@ -44,4 +44,4 @@ clean:
|
||||
run-local:
|
||||
rm -f web
|
||||
ln -s ../web/dist web
|
||||
uvicorn src.api:app
|
||||
USE_EXAMPLE_REPO=1 uvicorn src.app:app
|
||||
@@ -5,7 +5,6 @@ setuptools.setup(
|
||||
python_requires=">=3.9",
|
||||
install_requires=[
|
||||
"ruamel.yaml==0.17.17",
|
||||
"SQLAlchemy==1.4.26",
|
||||
"fastapi==0.70.0",
|
||||
"pydantic==1.8.2",
|
||||
"uvicorn[standard]==0.15.0",
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
from src.automations.manager import AutomationManager
|
||||
from src.hass_config import find_hass_config
|
||||
|
||||
hass_config = find_hass_config()
|
||||
automations = AutomationManager(hass_config)
|
||||
@@ -1,6 +1,6 @@
|
||||
from src.automations.manager import AutomationManager
|
||||
from src.hass_config import find_hass_config
|
||||
from .app import make_app
|
||||
from src.api.app import make_app
|
||||
|
||||
hass_config = find_hass_config()
|
||||
app = make_app(AutomationManager(hass_config))
|
||||
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
from typing import cast
|
||||
from decouple import config
|
||||
from pathlib import Path
|
||||
from .loader import HassConfig
|
||||
@@ -6,6 +7,10 @@ from .loader import HassConfig
|
||||
|
||||
def find_hass_config() -> HassConfig:
|
||||
"""Try to find HASS config."""
|
||||
if config("USE_EXAMPLE_REPO", False, cast=bool):
|
||||
from tests.utils import create_copy_of_example_config
|
||||
return HassConfig(create_copy_of_example_config())
|
||||
|
||||
if "HASSIO_TOKEN" in os.environ:
|
||||
return HassConfig(Path("/config"))
|
||||
|
||||
|
||||
Reference in new issue
Block a user