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 working_dir: /lookyloo
tty: true tty: true
environment: environment:
- SPLASH_URL=http://splash:8050 - SPLASH_URL_DOCKER=http://splash:8050
command: command:
- /bin/sh - /bin/sh
- -c - -c

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os
import base64 import base64
from collections import defaultdict, Counter 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.redis: Redis = Redis(unix_socket_path=get_socket_path('cache'), decode_responses=True)
self.scrape_dir: Path = get_homedir() / 'scraped' 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') self.only_global_lookups: bool = self.get_config('only_global_lookups')
safe_create_dir(self.scrape_dir) safe_create_dir(self.scrape_dir)