Skip to content

Commit

Permalink
Merge pull request #182 from Ilhasoft/develop
Browse files Browse the repository at this point in the history
Version 1.14.2
  • Loading branch information
Douglas Paz committed Jul 13, 2018
2 parents ab03175 + c5114e9 commit 0f94669
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 33 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
19 changes: 19 additions & 0 deletions bothub/common/migrations/0015_auto_20180712_2130.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.0.6 on 2018-07-12 21:30

import bothub.common.languages
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('common', '0014_auto_20180709_1909'),
]

operations = [
migrations.AlterField(
model_name='repository',
name='language',
field=models.CharField(help_text="Repository's examples language. The examples can be translated to other languages.", max_length=5, validators=[bothub.common.languages.validate_language], verbose_name='language'),
),
]
19 changes: 19 additions & 0 deletions bothub/common/migrations/0016_auto_20180712_2131.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.0.6 on 2018-07-12 21:31

import bothub.common.languages
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('common', '0015_auto_20180712_2130'),
]

operations = [
migrations.AlterField(
model_name='repositoryupdate',
name='language',
field=models.CharField(max_length=5, validators=[bothub.common.languages.validate_language], verbose_name='language'),
),
]
19 changes: 19 additions & 0 deletions bothub/common/migrations/0017_auto_20180712_2131.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.0.6 on 2018-07-12 21:31

import bothub.common.languages
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('common', '0016_auto_20180712_2131'),
]

operations = [
migrations.AlterField(
model_name='repositorytranslatedexample',
name='language',
field=models.CharField(help_text='Translation language', max_length=5, validators=[bothub.common.languages.validate_language], verbose_name='language'),
),
]
6 changes: 3 additions & 3 deletions bothub/common/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Meta:
help_text=_('Easy way to found and share repositories'))
language = models.CharField(
_('language'),
max_length=2,
max_length=5,
help_text=_('Repository\'s examples language. The examples can be ' +
'translated to other languages.'),
validators=[
Expand Down Expand Up @@ -292,7 +292,7 @@ class Meta:
related_name='updates')
language = models.CharField(
_('language'),
max_length=2,
max_length=5,
validators=[
languages.validate_language,
])
Expand Down Expand Up @@ -488,7 +488,7 @@ class Meta:
help_text=_('Example object'))
language = models.CharField(
_('language'),
max_length=2,
max_length=5,
help_text=_('Translation language'),
validators=[
languages.validate_language,
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.1',
version='1.14.2',
description='bothub',
packages=find_packages(),
install_requires=[
Expand Down

0 comments on commit 0f94669

Please sign in to comment.