From 216156880237251ddd10df9a2b82c68de7696d25 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sun, 29 Mar 2020 00:07:01 +0100 Subject: DEBUG set to False by default. --- docker-compose.yml | 5 +--- instance/config.py | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ instance/production.py | 74 -------------------------------------------------- wait-for-postgres.sh | 2 +- 4 files changed, 76 insertions(+), 79 deletions(-) create mode 100644 instance/config.py delete mode 100644 instance/production.py diff --git a/docker-compose.yml b/docker-compose.yml index 3634afc2..fd3bd0e0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,11 +21,8 @@ services: context: . dockerfile: ./Dockerfile tty: true - volumes: - - .:/newspipe:rw - - /newspipe/static/npm_components/ environment: - - Newspipe_CONFIG=/newspipe/instance/production.py + - Newspipe_CONFIG=/newspipe/instance/config.py ports: - "5000:5000" expose: diff --git a/instance/config.py b/instance/config.py new file mode 100644 index 00000000..8a3fdb6b --- /dev/null +++ b/instance/config.py @@ -0,0 +1,74 @@ +import os + +# +# Example configuration file for a PostgreSQL database. +# + +# Webserver +HOST = "0.0.0.0" +PORT = 5000 +DEBUG = True +API_ROOT = "/api/v2.0" + +CSRF_ENABLED = True +SECRET_KEY = "LCx3BchmHRxFzkEv4BqQJyeXRLXenf" +SECURITY_PASSWORD_SALT = "L8gTsyrpRQEF8jNWQPyvRfv7U5kJkD" + +# Database +DB_CONFIG_DICT = { + "user": "postgres", + "password": "password", + "host": "db", + "port": 5432, +} +DATABASE_NAME = "postgres" +SQLALCHEMY_DATABASE_URI = "postgres://{user}:{password}@{host}:{port}/{name}".format( + name=DATABASE_NAME, **DB_CONFIG_DICT +) + +# Security +CONTENT_SECURITY_POLICY = { + 'default-src': '\'self\'', + 'img-src': '*', + 'media-src': [ + 'youtube.com', + ], + 'script-src': [ + '\'self\'', + '\'unsafe-inline\'', + ], + 'style-src': [ + '\'self\'', + '\'unsafe-inline\'', + ] +} +# Crawler +CRAWLING_METHOD = "default" +DEFAULT_MAX_ERROR = 6 +HTTP_PROXY = "" +CRAWLER_USER_AGENT = "Newspipe (https://git.sr.ht/~cedric/newspipe)" +CRAWLER_TIMEOUT = 30 +CRAWLER_RESOLV = False +RESOLVE_ARTICLE_URL = False +FEED_REFRESH_INTERVAL = 120 + +# Notification +MAIL_SERVER = "localhost" +MAIL_PORT = 25 +MAIL_USE_TLS = False +MAIL_USE_SSL = False +MAIL_DEBUG = DEBUG +MAIL_USERNAME = None +MAIL_PASSWORD = None +MAIL_DEFAULT_SENDER = "admin@admin.localhost" +TOKEN_VALIDITY_PERIOD = 3600 +PLATFORM_URL = "https://www.newspipe.org" + +# Misc +BASE_DIR = os.path.abspath(os.path.dirname(".")) +LANGUAGES = {"en": "English", "fr": "French"} +TIME_ZONE = {"en": "US/Eastern", "fr": "Europe/Paris"} +ADMIN_EMAIL = "admin@admin.localhost" +LOG_LEVEL = "info" +LOG_PATH = "./var/newspipe.log" +SELF_REGISTRATION = True diff --git a/instance/production.py b/instance/production.py deleted file mode 100644 index 90f27c1c..00000000 --- a/instance/production.py +++ /dev/null @@ -1,74 +0,0 @@ -import os - -# -# Example configuration file for a PostgreSQL database. -# - -# Webserver -HOST = "0.0.0.0" -PORT = 5000 -DEBUG = False -API_ROOT = "/api/v2.0" - -CSRF_ENABLED = True -SECRET_KEY = "LCx3BchmHRxFzkEv4BqQJyeXRLXenf" -SECURITY_PASSWORD_SALT = "L8gTsyrpRQEF8jNWQPyvRfv7U5kJkD" - -# Database -DB_CONFIG_DICT = { - "user": "postgres", - "password": "password", - "host": "db", - "port": 5432, -} -DATABASE_NAME = "postgres" -SQLALCHEMY_DATABASE_URI = "postgres://{user}:{password}@{host}:{port}/{name}".format( - name=DATABASE_NAME, **DB_CONFIG_DICT -) - -# Security -CONTENT_SECURITY_POLICY = { - 'default-src': '\'self\'', - 'img-src': '*', - 'media-src': [ - 'youtube.com', - ], - 'script-src': [ - '\'self\'', - '\'unsafe-inline\'', - ], - 'style-src': [ - '\'self\'', - '\'unsafe-inline\'', - ] -} -# Crawler -CRAWLING_METHOD = "default" -DEFAULT_MAX_ERROR = 6 -HTTP_PROXY = "" -CRAWLER_USER_AGENT = "Newspipe (https://git.sr.ht/~cedric/newspipe)" -CRAWLER_TIMEOUT = 30 -CRAWLER_RESOLV = False -RESOLVE_ARTICLE_URL = False -FEED_REFRESH_INTERVAL = 120 - -# Notification -MAIL_SERVER = "localhost" -MAIL_PORT = 25 -MAIL_USE_TLS = False -MAIL_USE_SSL = False -MAIL_DEBUG = DEBUG -MAIL_USERNAME = None -MAIL_PASSWORD = None -MAIL_DEFAULT_SENDER = "admin@admin.localhost" -TOKEN_VALIDITY_PERIOD = 3600 -PLATFORM_URL = "https://www.newspipe.org" - -# Misc -BASE_DIR = os.path.abspath(os.path.dirname(".")) -LANGUAGES = {"en": "English", "fr": "French"} -TIME_ZONE = {"en": "US/Eastern", "fr": "Europe/Paris"} -ADMIN_EMAIL = "admin@admin.localhost" -LOG_LEVEL = "info" -LOG_PATH = "./var/newspipe.log" -SELF_REGISTRATION = True diff --git a/wait-for-postgres.sh b/wait-for-postgres.sh index e6bbd619..3f4e7067 100755 --- a/wait-for-postgres.sh +++ b/wait-for-postgres.sh @@ -13,7 +13,7 @@ do done >&2 echo "Postgres is up - executing command" -export Newspipe_CONFIG=/newspipe/instance/production.py +export Newspipe_CONFIG=/newspipe/instance/config.py poetry run ./manager.py db_create >/dev/null poetry run pybabel compile -d newspipe/translations poetry run ./runserver.py -- cgit