Add settings example
This commit is contained in:
7
main.py
7
main.py
@@ -15,7 +15,6 @@ import hashlib
|
|||||||
|
|
||||||
import settings
|
import settings
|
||||||
|
|
||||||
NAVIDROME_CONTAINER = getattr(settings, 'NAVIDROME_CONTAINER', 'navidrome-navidrome-1')
|
|
||||||
STAR_UNSTAR_WINDOW = timedelta(seconds=4)
|
STAR_UNSTAR_WINDOW = timedelta(seconds=4)
|
||||||
|
|
||||||
# A dictionary to store the timestamp of when a song was starred.
|
# A dictionary to store the timestamp of when a song was starred.
|
||||||
@@ -101,9 +100,9 @@ async def main():
|
|||||||
docker = None
|
docker = None
|
||||||
try:
|
try:
|
||||||
docker = aiodocker.Docker()
|
docker = aiodocker.Docker()
|
||||||
container = await docker.containers.get(NAVIDROME_CONTAINER)
|
container = await docker.containers.get(settings.NAVIDROME_CONTAINER)
|
||||||
|
|
||||||
logging.info(f"Monitoring logs for container '{NAVIDROME_CONTAINER}'...")
|
logging.info(f"Monitoring logs for container '{settings.NAVIDROME_CONTAINER}'...")
|
||||||
logs = container.log(
|
logs = container.log(
|
||||||
stdout=True,
|
stdout=True,
|
||||||
stderr=True,
|
stderr=True,
|
||||||
@@ -132,7 +131,7 @@ async def main():
|
|||||||
|
|
||||||
except aiodocker.exceptions.DockerError as e:
|
except aiodocker.exceptions.DockerError as e:
|
||||||
if e.status == 404:
|
if e.status == 404:
|
||||||
logging.error(f"Container '{NAVIDROME_CONTAINER}' not found.")
|
logging.error(f"Container '{settings.NAVIDROME_CONTAINER}' not found.")
|
||||||
else:
|
else:
|
||||||
logging.error(f"Error connecting to Docker or getting container: {e}")
|
logging.error(f"Error connecting to Docker or getting container: {e}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
11
settings.py.example
Normal file
11
settings.py.example
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
NAVIDROME_CONTAINER = 'navidrome-navidrome-1'
|
||||||
|
NAVIDROME_URL = 'https://navidrome.example.com'
|
||||||
|
|
||||||
|
NAVIDROME_USER = ''
|
||||||
|
|
||||||
|
# Set this one:
|
||||||
|
NAVIDROME_PASSWORD = ''
|
||||||
|
# or these two:
|
||||||
|
SUBSONIC_SALT = ''
|
||||||
|
SUBSONIC_TOKEN = ''
|
||||||
|
|
||||||
Reference in New Issue
Block a user