chg: Docker, default to env variable for splash URL

pull/78/head
Raphaël Vinot 2020-07-07 13:51:09 +02:00
parent fb1e98e05e
commit 4cfe91392a
2 changed files with 7 additions and 2 deletions

View File

@ -20,7 +20,7 @@ services:
working_dir: /lookyloo
tty: true
environment:
- SPLASH_URL=http://splash:8050
- SPLASH_URL_DOCKER=http://splash:8050
command:
- /bin/sh
- -c

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import base64
from collections import defaultdict, Counter
@ -40,7 +41,11 @@ class Lookyloo():
self.redis: Redis = Redis(unix_socket_path=get_socket_path('cache'), decode_responses=True)
self.scrape_dir: Path = get_homedir() / 'scraped'
self.splash_url: str = self.get_config('splash_url')
if os.environ.get('SPLASH_URL_DOCKER'):
# In order to have a working default for the docker image, it is easier to use an environment variable
self.splash_url: str = os.environ['SPLASH_URL_DOCKER']
else:
self.splash_url = self.get_config('splash_url')
self.only_global_lookups: bool = self.get_config('only_global_lookups')
safe_create_dir(self.scrape_dir)