From 4cfe91392a8d63a637b193f4b110519be4d42ae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 7 Jul 2020 13:51:09 +0200 Subject: [PATCH] chg: Docker, default to env variable for splash URL --- docker-compose.yml | 2 +- lookyloo/lookyloo.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 83ce02eb..1aba4cb4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/lookyloo/lookyloo.py b/lookyloo/lookyloo.py index 012a0235..ea6c8fce 100644 --- a/lookyloo/lookyloo.py +++ b/lookyloo/lookyloo.py @@ -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)