Skip to content

Commit

Permalink
slyd: read settings from env
Browse files Browse the repository at this point in the history
  • Loading branch information
milahu committed Apr 16, 2022
1 parent e8539e1 commit f70a856
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
13 changes: 11 additions & 2 deletions slyd/bin/slyd
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@
import splash.server
import splash.defaults
import argparse
import os


DEFAULT_PORTIA_PORT = 9001
DEFAULT_PORTIA_ROOT = '../portiaui/dist'
print("default DEFAULT_PORTIA_ROOT:", os.path.join(os.path.dirname(__file__), '../portiaui/dist'))

DEFAULT_PORTIA_PORT = os.environ.get('PORTIA_PORT', 9001)
DEFAULT_PORTIA_ROOT = os.environ.get(
'PORTIA_ROOT',
os.path.join(os.path.dirname(__file__), '../portiaui/dist')
)

print("current DEFAULT_PORTIA_ROOT:", DEFAULT_PORTIA_ROOT)

splash.defaults.SPLASH_PORT = DEFAULT_PORTIA_PORT

def parse_args():
Expand Down
5 changes: 3 additions & 2 deletions slyd/slyd/settings/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Scrapy settings"""
from os.path import join, dirname
import os

EXTENSIONS = {
'scrapy.contrib.logstats.LogStats': None,
Expand All @@ -11,8 +12,8 @@
LOG_LEVEL = 'DEBUG'

# location of slybot projects - assumes a subdir per project
DATA_DIR = join(dirname(dirname(__file__)), 'data')
SPEC_DATA_DIR = join(DATA_DIR, 'projects')
DATA_DIR = os.environ.get("DATA_DIR", join(dirname(dirname(__file__)), 'data'))
SPEC_DATA_DIR = os.environ.get("SPEC_DATA_DIR", join(DATA_DIR, 'projects'))

DJANGO_SETTINGS = 'portia_server.settings'

Expand Down

0 comments on commit f70a856

Please sign in to comment.