Skip to content

Commit

Permalink
Merge 8db68f8 into 59bc9da
Browse files Browse the repository at this point in the history
  • Loading branch information
Douglas Paz authored Jul 12, 2018
2 parents 59bc9da + 8db68f8 commit 79a7647
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 30 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ You can set environment variables in your OS, write on ```.env``` file or pass v
| LANGUAGE_CODE | ```string``` | ```en-us``` | A string representing the language code for this installation.This should be in standard [language ID format](https://docs.djangoproject.com/en/2.0/topics/i18n/#term-language-code).
| TIME_ZONE | ```string``` | ```UTC``` | A string representing the time zone for this installation. See the [list of time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
| STATIC_URL | ```string``` | ```/static/``` | URL to use when referring to static files located in ```STATIC_ROOT```.
| EMAIL_HOST | ```string``` | ```None``` | The host to use for sending email. When setted to ```None``` and ```DEBUG``` is ```True```, the ```EMAIL_BACKEND``` setting is setted to ```django.core.mail.backends.console.EmailBackend```
| EMAIL_HOST | ```string``` | ```None``` | The host to use for sending email. When setted to ```None``` or empty string, the ```EMAIL_BACKEND``` setting is setted to ```django.core.mail.backends.console.EmailBackend```
| EMAIL_PORT | ```int``` | ```25``` | Port to use for the SMTP server defined in ```EMAIL_HOST```.
| DEFAULT_FROM_EMAIL | ```string``` | ```webmaster@localhost``` | Default email address to use for various automated correspondence from the site manager(s).
| SERVER_EMAIL | ```string``` | ```root@localhost``` | The email address that error messages come from, such as those sent to ```ADMINS``` and ```MANAGERS```.
Expand Down
9 changes: 7 additions & 2 deletions bothub/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.utils.log import DEFAULT_LOGGING

from .utils import cast_supported_languages
from .utils import cast_empty_str_to_none


# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
Expand Down Expand Up @@ -156,7 +157,10 @@

# mail

envvar_EMAIL_HOST = config('EMAIL_HOST', default=None)
envvar_EMAIL_HOST = config(
'EMAIL_HOST',
default=None,
cast=cast_empty_str_to_none)

ADMINS = config(
'ADMINS',
Expand Down Expand Up @@ -203,7 +207,8 @@

CSRF_COOKIE_DOMAIN = config(
'CSRF_COOKIE_DOMAIN',
default=None)
default=None,
cast=cast_empty_str_to_none)

CSRF_COOKIE_SECURE = config(
'CSRF_COOKIE_SECURE',
Expand Down
4 changes: 4 additions & 0 deletions bothub/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ def cast_supported_languages(i):
x.split(':', 1) if ':' in x else (x, x) for x in
i.split('|')
])


def cast_empty_str_to_none(value):
return value or None
59 changes: 34 additions & 25 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
version: '3.3'

services:
database:
image: postgres
ports:
- 5432:5432
environment:
- POSTGRES_USER=${POSTGRES_USER:-bothub}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-bothub}
- POSTGRES_DB=${POSTGRES_DB:-bothub}
bothub:
image: ${DOCKER_IMAGE_NAME:-ilha/bothub}:${TAG:-latest}
build:
Expand All @@ -9,28 +17,29 @@ services:
ports:
- 80:80
environment:
- SECRET_KEY=SK
- DEBUG
- ALLOWED_HOSTS
- DEFAULT_DATABASE
- LANGUAGE_CODE
- TIME_ZONE
- EMAIL_HOST=
- EMAIL_PORT
- DEFAULT_FROM_EMAIL
- SERVER_EMAIL
- EMAIL_HOST_USER
- EMAIL_HOST_PASSWORD
- EMAIL_USE_SSL
- EMAIL_USE_TLS
- ADMINS
- CSRF_COOKIE_DOMAIN
- CSRF_COOKIE_SECURE
- BOTHUB_WEBAPP_BASE_URL=http://localhost/
- BOTHUB_NLP_BASE_URL
- BUILD_WEBAPP=true
- WEBAPP_REPO=https://github.com/Ilhasoft/bothub-webapp
- WEBAPP_BRANCH=master
- API_BASE_URL=/api
- CHECK_ACCESSIBLE_API_URL
- SEND_EMAILS
- SECRET_KEY=${SECRET_KEY:-SK}
- DEBUG=${DEBUG:-true}
- ALLOWED_HOSTS=${ALLOWED_HOSTS:-*}
- DEFAULT_DATABASE=${DEFAULT_DATABASE:-postgres://bothub:bothub@database:5432/bothub}
- LANGUAGE_CODE=${LANGUAGE_CODE:-en-us}
- TIME_ZONE=${TIME_ZONE:-UTC}
- EMAIL_HOST=${EMAIL_HOST:-}
- EMAIL_PORT=${EMAIL_PORT:-25}
- DEFAULT_FROM_EMAIL=${DEFAULT_FROM_EMAIL:-webmaster@localhost}
- SERVER_EMAIL=${SERVER_EMAIL:-root@localhost}
- EMAIL_HOST_USER=${EMAIL_HOST_USER:-}
- EMAIL_HOST_PASSWORD=${EMAIL_HOST_PASSWORD:-}
- EMAIL_USE_SSL=${EMAIL_USE_SSL:-false}
- EMAIL_USE_TLS=${EMAIL_USE_TLS:-false}
- ADMINS=${ADMINS:-}
- CSRF_COOKIE_DOMAIN=${CSRF_COOKIE_DOMAIN:-}
- CSRF_COOKIE_SECURE=${CSRF_COOKIE_SECURE:-false}
- BOTHUB_WEBAPP_BASE_URL=${BOTHUB_WEBAPP_BASE_URL:-http://localhost/}
- BOTHUB_NLP_BASE_URL=${BOTHUB_NLP_BASE_URL:-http://localhost:2657/}
- BUILD_WEBAPP=${BUILD_WEBAPP:-true}
- WEBAPP_REPO=${WEBAPP_REPO:-https://github.com/Ilhasoft/bothub-webapp}
- WEBAPP_BRANCH=${WEBAPP_BRANCH:-master}
- API_BASE_URL=${API_BASE_URL:-/api}
- CHECK_ACCESSIBLE_API_URL=${CHECK_ACCESSIBLE_API_URL:-}
- SEND_EMAILS=${SEND_EMAILS:-true}
- SUPPORTED_LANGUAGES=${SUPPORTED_LANGUAGES:-en|pt}
2 changes: 1 addition & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
if [ ${BUILD_WEBAPP} ]; then
if [ ${BUILD_WEBAPP} == true ]; then
git clone --branch $WEBAPP_BRANCH --depth 1 $WEBAPP_REPO /tmp/bothub-webapp/
cd /tmp/bothub-webapp/ && npm install && npm run build
fi
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='bothub',
version='1.14.0',
version='1.14.1',
description='bothub',
packages=find_packages(),
install_requires=[
Expand Down

0 comments on commit 79a7647

Please sign in to comment.