Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ability to pass config via env-var #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions SpiderKeeper/app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@

# basic auth
NO_AUTH = False
BASIC_AUTH_USERNAME = 'admin'
BASIC_AUTH_PASSWORD = 'admin'
BASIC_AUTH_USERNAME = os.environ.get('USERNAME', None)
BASIC_AUTH_PASSWORD = os.environ.get('PASSWORD', None)
BASIC_AUTH_FORCE = True
5 changes: 3 additions & 2 deletions SpiderKeeper/scrapyd/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-

import os
from scrapyd.app import application as create_scrapyd_application
from twisted.web.wsgi import WSGIResource
from twisted.internet import reactor
Expand All @@ -9,10 +9,11 @@


def create_spiderkeeper_application(scrapyd_config, flask_config=default_config):
REACTOR_PORT = int(os.environ.get('REACTOR_PORT', 5000))
flask_app = create_flask_application(flask_config)
run_scheduler(flask_app)
app = create_scrapyd_application(scrapyd_config)
resource = WSGIResource(reactor, reactor.getThreadPool(), flask_app)
site = Site(resource)
reactor.listenTCP(5000, site)
reactor.listenTCP(REACTOR_PORT, site)
return app