mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
* POC replace travis by Github Actions * add libldap2-dev * add libsasl2-dev libssl-dev * Delete .travis.yml * Add specific configuration for PostgreSQL * Retrieve PostgreSQL or MySQL port from env var * Print affected port for the docker service * Add Database type and dburl * Fix dbtype * Use environment variable to define the port in use for tests. * Configured password for postgres connection. * Added redis service. * Enabled OpenLDAP service. * Use a container for OpenLDAP too. * Removed wrong option. * Fixed volume syntax. * Try using the option directly. * Try using an absolute path. * Fixed wrong syntax. * Try different format for env variable. * Try a different way to load data. * Added missing method call. * Fix envar * Try to wait a bit before starting tests. * Display openldap service logs. * Fixed ldif scripts path. * Try to use a custom docker image. * Try to provide credentials. * Try with github token. * use main reference * Changed LDAP Admin password. * Added debug. * Added more debug * Removed debug. * dd test for MySQL * Fix name * Test is independant * Link build * add envar DB for MySQL * remove depends * fix fast failed * fix mysql user * Use 127.0.0.1 to force for IPv4 * For parameters for MySQL * Database name test_modoboa * change mysql user to launch test * Move to the last mysql version lose connection on 5.7 * TEst some timout parameters * remove bad parameters * Add CONN_MAX_AGE parameters * Add docker logs * Try to reset db connections before we spawn processes. * POC replace travis by Github Actions * add libldap2-dev * add libsasl2-dev libssl-dev * Delete .travis.yml * Add specific configuration for PostgreSQL * Retrieve PostgreSQL or MySQL port from env var * Print affected port for the docker service * Add Database type and dburl * Fix dbtype * Use environment variable to define the port in use for tests. * Configured password for postgres connection. * Added redis service. * Enabled OpenLDAP service. * Use a container for OpenLDAP too. * Removed wrong option. * Fixed volume syntax. * Try using the option directly. * Try using an absolute path. * Fixed wrong syntax. * Try different format for env variable. * Try a different way to load data. * Added missing method call. * Fix envar * Try to wait a bit before starting tests. * Display openldap service logs. * Fixed ldif scripts path. * Try to use a custom docker image. * Try to provide credentials. * Try with github token. * use main reference * Changed LDAP Admin password. * Added debug. * Added more debug * Removed debug. * dd test for MySQL * Fix name * Test is independant * Link build * add envar DB for MySQL * remove depends * fix fast failed * fix mysql user * Use 127.0.0.1 to force for IPv4 * For parameters for MySQL * Database name test_modoboa * change mysql user to launch test * Move to the last mysql version lose connection on 5.7 * TEst some timout parameters * remove bad parameters * Add CONN_MAX_AGE parameters * Add docker logs * Try to reset db connections before we spawn processes. * Add relase on pypi (test server first) * Fix setuptools scm to fix upload on Pypi test * Retrieve all repos when publish on pypi * if file exists, skip it * Deploy only on master * Added python 3.5 in matrix. * Removed comments. * Add translation and codecov * Missing argument for upload in production * fix bad indentation * move codecov * Codecov only in one build * fix command * Try to run codecov after PG tests. * Fixed expressions syntax. * Fixed path issue. * Fixed path issue. * Try workflow_run statement. * Removed useless triggers. * Test trigger on one workflow * Another test * Exclude master and main branch * Regroup all steps in one workflow. * Fixed typo * Fixed bad syntax * Added missing requirement. * Push on Pypi Test only on master branch Co-authored-by: Antoine Nguyen <tonio@ngyn.org>
66 lines
2.0 KiB
Python
66 lines
2.0 KiB
Python
import os
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
|
|
|
|
DB = os.environ.get("DB", "postgres").lower()
|
|
|
|
if DB == "mysql":
|
|
DATABASES = {
|
|
"default": {
|
|
"ENGINE": "django.db.backends.mysql",
|
|
"NAME": "modoboa",
|
|
"USER": os.environ.get("MYSQL_USER", "root"),
|
|
"PASSWORD": os.environ.get("MYSQL_PASSWORD", "root"),
|
|
"HOST": "127.0.0.1",
|
|
"PORT": os.environ.get("MYSQL_PORT", "3306"),
|
|
"ATOMIC_REQUESTS": True,
|
|
# MySQL's Strict Mode fixes many data integrity problems in MySQL,
|
|
# such as data truncation upon insertion, by escalating warnings
|
|
# into errors. It is strongly recommended you activate it.
|
|
# MySQL >= 5.7 set STRICT_TRANS_TABLES by default
|
|
# See:
|
|
# https://docs.djangoproject.com/en/2.2/ref/databases/#mysql-sql-mode
|
|
"OPTIONS": {
|
|
"init_command": (
|
|
"SET sql_mode = 'STRICT_TRANS_TABLES';"
|
|
"SET innodb_strict_mode = ON;"
|
|
),
|
|
"charset": "utf8",
|
|
"connect_timeout": 10,
|
|
},
|
|
"TEST": {
|
|
"CHARSET": "utf8",
|
|
"COLLATION": "utf8_unicode_ci",
|
|
},
|
|
},
|
|
}
|
|
elif DB == "sqlite":
|
|
DATABASES = {
|
|
"default": {
|
|
"ENGINE": "django.db.backends.sqlite3",
|
|
"NAME": "modoboa.db",
|
|
"PORT": "",
|
|
"ATOMIC_REQUESTS": True,
|
|
},
|
|
}
|
|
else:
|
|
DATABASES = {
|
|
"default": {
|
|
"ENGINE": "django.db.backends.postgresql",
|
|
"NAME": "modoboa",
|
|
"USER": "postgres",
|
|
"PASSWORD": "postgres",
|
|
"HOST": "localhost",
|
|
"PORT": os.environ.get("POSTGRES_PORT", "5432"),
|
|
"ATOMIC_REQUESTS": True,
|
|
"OPTIONS": {
|
|
"client_encoding": "UTF8",
|
|
"sslmode": "disable"
|
|
},
|
|
"TEST": {
|
|
"CHARSET": "UTF8",
|
|
},
|
|
},
|
|
}
|