Use different way of os.getenv defaults, add mail login

This commit is contained in:
Disassembler 2022-03-08 13:52:48 +01:00
parent b01126104d
commit 0620c6ebd0
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
6 changed files with 41 additions and 41 deletions

1
.env
View File

@ -8,6 +8,7 @@ SAHANA_ADMIN_USER=admin
SAHANA_ADMIN_PASSWORD=sahana
SAHANA_MAIL_HOST=127.0.0.1:25
SAHANA_MAIL_LOGIN=username:password
SAHANA_MAIL_SENDER='Sahana' <sahana@example.org>
SAHANA_MAIL_APPROVER=useradmin@example.org

View File

@ -15,7 +15,6 @@ services:
ports:
- 8080:8080
volumes:
- sahana_models:/srv/web2py/applications/eden/models
- sahana_databases:/srv/web2py/applications/eden/databases
- sahana_errors:/srv/web2py/applications/eden/errors
- sahana_sessions:/srv/web2py/applications/eden/sessions
@ -32,7 +31,6 @@ services:
- postgres_data:/var/lib/postgresql/data
volumes:
sahana_models:
sahana_databases:
sahana_errors:
sahana_sessions:

View File

@ -32,17 +32,17 @@ settings.base.template = "SAMBRO"
settings.database.db_type = "postgres"
#settings.database.db_type = "mysql"
# Uncomment to use a different host
settings.database.host = os.getenv("POSTGRES_HOST", "localhost")
settings.database.host = os.getenv("POSTGRES_HOST") or "localhost"
# Uncomment to use a different port
#settings.database.port = 3306
#settings.database.port = 5432
# Uncomment to select a different name for your database
settings.database.database = os.getenv("POSTGRES_DB", "sahana")
settings.database.database = os.getenv("POSTGRES_DB") or "sahana"
# Uncomment to select a different username for your database
settings.database.username = os.getenv("POSTGRES_USER", "sahana")
settings.database.username = os.getenv("POSTGRES_USER") or "sahana"
# Uncomment to set the password
# NB Web2Py doesn't like passwords with an @ in them
settings.database.password = os.getenv("POSTGRES_PASSWORD", "password")
settings.database.password = os.getenv("POSTGRES_PASSWORD") or "password"
# Uncomment to use a different pool size
#settings.database.pool_size = 30
# Do we have a spatial DB available? (currently supports PostGIS. Spatialite to come.)
@ -52,7 +52,7 @@ settings.gis.spatialdb = True
settings.base.system_name = T("Sahana Alerting and Messaging Broker")
settings.base.system_name_short = T("SAMBRO")
# Set this to the Public URL of the instance
settings.base.public_url = os.getenv("SAHANA_PUBLIC_URL", "http://127.0.0.1:8080")
settings.base.public_url = os.getenv("SAHANA_PUBLIC_URL") or "http://127.0.0.1:8080"
# Switch to "False" in Production for a Performance gain
# (need to set to "True" again when Table definitions are changed)
@ -87,7 +87,7 @@ settings.base.debug = True
# This setting should be changed _before_ registering the 1st user
# - should happen automatically if installing using supported scripts
settings.auth.hmac_key = os.getenv("SAHANA_HMAC_KEY", "akeytochange")
settings.auth.hmac_key = os.getenv("SAHANA_HMAC_KEY") or "akeytochange"
# If using Masterkey Authentication, then set this to a deployment-specific 32 char string:
#settings.auth.masterkey_app_key = "randomstringrandomstringrandomstring"
@ -97,18 +97,18 @@ settings.auth.hmac_key = os.getenv("SAHANA_HMAC_KEY", "akeytochange")
# Email settings
# Outbound server
settings.mail.server = os.getenv("SAHANA_MAIL_HOST", "127.0.0.1:25")
settings.mail.server = os.getenv("SAHANA_MAIL_HOST") or "127.0.0.1:25"
#settings.mail.tls = True
# Useful for Windows Laptops:
# https://www.google.com/settings/security/lesssecureapps
#settings.mail.server = "smtp.gmail.com:587"
#settings.mail.tls = True
#settings.mail.login = "username:password"
settings.mail.tls = True
settings.mail.login = os.getenv("SAHANA_MAIL_LOGIN") or False
# From Address - until this is set, no mails can be sent
settings.mail.sender = os.getenv("SAHANA_MAIL_SENDER", "'Sahana' <sahana@example.org>")
settings.mail.sender = os.getenv("SAHANA_MAIL_SENDER") or "'Sahana' <sahana@example.org>"
# Default email address to which requests to approve new user accounts gets sent
# This can be overridden for specific domains/organisations via the auth_domain table
settings.mail.approver = os.getenv("SAHANA_MAIL_APPROVER", "useradmin@example.org")
settings.mail.approver = os.getenv("SAHANA_MAIL_APPROVER") or "useradmin@example.org"
# Daily Limit on Sending of emails
#settings.mail.limit = 1000
@ -121,9 +121,9 @@ settings.mail.approver = os.getenv("SAHANA_MAIL_APPROVER", "useradmin@example.or
# GetAddress API Key (for GetAddress.io Postcode to Address lookup)
#settings.gis.api_getaddress = ""
# Google API Key (for Google Maps Layers)
settings.gis.api_google = os.getenv("SAHANA_API_KEY_GOOGLE", "")
settings.gis.api_google = os.getenv("SAHANA_API_KEY_GOOGLE") or ""
# OpenWeatherMap API Key (for OpenWeatherMap Layers)
settings.gis.api_openweathermap = os.getenv("SAHANA_API_KEY_OPENWEATHERMAP", "")
settings.gis.api_openweathermap = os.getenv("SAHANA_API_KEY_OPENWEATHERMAP") or ""
# GeoNames username
#settings.gis.geonames_username = ""

View File

@ -32,17 +32,17 @@ settings.base.template = "Spotter"
settings.database.db_type = "postgres"
#settings.database.db_type = "mysql"
# Uncomment to use a different host
settings.database.host = os.getenv("POSTGRES_HOST", "localhost")
settings.database.host = os.getenv("POSTGRES_HOST") or "localhost"
# Uncomment to use a different port
#settings.database.port = 3306
#settings.database.port = 5432
# Uncomment to select a different name for your database
settings.database.database = os.getenv("POSTGRES_DB", "sahana")
settings.database.database = os.getenv("POSTGRES_DB") or "sahana"
# Uncomment to select a different username for your database
settings.database.username = os.getenv("POSTGRES_USER", "sahana")
settings.database.username = os.getenv("POSTGRES_USER") or "sahana"
# Uncomment to set the password
# NB Web2Py doesn't like passwords with an @ in them
settings.database.password = os.getenv("POSTGRES_PASSWORD", "password")
settings.database.password = os.getenv("POSTGRES_PASSWORD") or "password"
# Uncomment to use a different pool size
#settings.database.pool_size = 30
# Do we have a spatial DB available? (currently supports PostGIS. Spatialite to come.)
@ -52,7 +52,7 @@ settings.gis.spatialdb = True
settings.base.system_name = T("Spotter Cluster")
settings.base.system_name_short = T("Spotter")
# Set this to the Public URL of the instance
settings.base.public_url = os.getenv("SAHANA_PUBLIC_URL", "http://127.0.0.1:8080")
settings.base.public_url = os.getenv("SAHANA_PUBLIC_URL") or "http://127.0.0.1:8080"
# Switch to "False" in Production for a Performance gain
# (need to set to "True" again when Table definitions are changed)
@ -87,7 +87,7 @@ settings.base.debug = True
# This setting should be changed _before_ registering the 1st user
# - should happen automatically if installing using supported scripts
settings.auth.hmac_key = os.getenv("SAHANA_HMAC_KEY", "akeytochange")
settings.auth.hmac_key = os.getenv("SAHANA_HMAC_KEY") or "akeytochange"
# If using Masterkey Authentication, then set this to a deployment-specific 32 char string:
#settings.auth.masterkey_app_key = "randomstringrandomstringrandomstring"
@ -97,18 +97,18 @@ settings.auth.hmac_key = os.getenv("SAHANA_HMAC_KEY", "akeytochange")
# Email settings
# Outbound server
settings.mail.server = os.getenv("SAHANA_MAIL_HOST", "127.0.0.1:25")
settings.mail.server = os.getenv("SAHANA_MAIL_HOST") or "127.0.0.1:25"
#settings.mail.tls = True
# Useful for Windows Laptops:
# https://www.google.com/settings/security/lesssecureapps
#settings.mail.server = "smtp.gmail.com:587"
#settings.mail.tls = True
#settings.mail.login = "username:password"
settings.mail.tls = True
settings.mail.login = os.getenv("SAHANA_MAIL_LOGIN") or False
# From Address - until this is set, no mails can be sent
settings.mail.sender = os.getenv("SAHANA_MAIL_SENDER", "'Sahana' <sahana@example.org>")
settings.mail.sender = os.getenv("SAHANA_MAIL_SENDER") or "'Sahana' <sahana@example.org>"
# Default email address to which requests to approve new user accounts gets sent
# This can be overridden for specific domains/organisations via the auth_domain table
settings.mail.approver = os.getenv("SAHANA_MAIL_APPROVER", "useradmin@example.org")
settings.mail.approver = os.getenv("SAHANA_MAIL_APPROVER") or "useradmin@example.org"
# Daily Limit on Sending of emails
#settings.mail.limit = 1000
@ -121,9 +121,9 @@ settings.mail.approver = os.getenv("SAHANA_MAIL_APPROVER", "useradmin@example.or
# GetAddress API Key (for GetAddress.io Postcode to Address lookup)
#settings.gis.api_getaddress = ""
# Google API Key (for Google Maps Layers)
settings.gis.api_google = os.getenv("SAHANA_API_KEY_GOOGLE", "")
settings.gis.api_google = os.getenv("SAHANA_API_KEY_GOOGLE") or ""
# OpenWeatherMap API Key (for OpenWeatherMap Layers)
settings.gis.api_openweathermap = os.getenv("SAHANA_API_KEY_OPENWEATHERMAP", "")
settings.gis.api_openweathermap = os.getenv("SAHANA_API_KEY_OPENWEATHERMAP") or ""
# GeoNames username
#settings.gis.geonames_username = ""

View File

@ -4,6 +4,7 @@ Defaults env_keep += "POSTGRES_DB"
Defaults env_keep += "POSTGRES_HOST"
Defaults env_keep += "SAHANA_HMAC_KEY"
Defaults env_keep += "SAHANA_MAIL_HOST"
Defaults env_keep += "SAHANA_MAIL_LOGIN"
Defaults env_keep += "SAHANA_MAIL_SENDER"
Defaults env_keep += "SAHANA_MAIL_APPROVER"
Defaults env_keep += "SAHANA_API_KEY_GOOGLE"

View File

@ -32,17 +32,17 @@ settings.base.template = "default"
settings.database.db_type = "postgres"
#settings.database.db_type = "mysql"
# Uncomment to use a different host
settings.database.host = os.getenv("POSTGRES_HOST", "localhost")
settings.database.host = os.getenv("POSTGRES_HOST") or "localhost"
# Uncomment to use a different port
#settings.database.port = 3306
#settings.database.port = 5432
# Uncomment to select a different name for your database
settings.database.database = os.getenv("POSTGRES_DB", "sahana")
settings.database.database = os.getenv("POSTGRES_DB") or "sahana"
# Uncomment to select a different username for your database
settings.database.username = os.getenv("POSTGRES_USER", "sahana")
settings.database.username = os.getenv("POSTGRES_USER") or "sahana"
# Uncomment to set the password
# NB Web2Py doesn't like passwords with an @ in them
settings.database.password = os.getenv("POSTGRES_PASSWORD", "password")
settings.database.password = os.getenv("POSTGRES_PASSWORD") or "password"
# Uncomment to use a different pool size
#settings.database.pool_size = 30
# Do we have a spatial DB available? (currently supports PostGIS. Spatialite to come.)
@ -52,7 +52,7 @@ settings.gis.spatialdb = True
#settings.base.system_name = T("Sahana Eden Humanitarian Management Platform")
#settings.base.system_name_short = T("Sahana Eden")
# Set this to the Public URL of the instance
settings.base.public_url = os.getenv("SAHANA_PUBLIC_URL", "http://127.0.0.1:8080")
settings.base.public_url = os.getenv("SAHANA_PUBLIC_URL") or "http://127.0.0.1:8080"
# Switch to "False" in Production for a Performance gain
# (need to set to "True" again when Table definitions are changed)
@ -87,7 +87,7 @@ settings.base.debug = True
# This setting should be changed _before_ registering the 1st user
# - should happen automatically if installing using supported scripts
settings.auth.hmac_key = os.getenv("SAHANA_HMAC_KEY", "akeytochange")
settings.auth.hmac_key = os.getenv("SAHANA_HMAC_KEY") or "akeytochange"
# If using Masterkey Authentication, then set this to a deployment-specific 32 char string:
#settings.auth.masterkey_app_key = "randomstringrandomstringrandomstring"
@ -97,18 +97,18 @@ settings.auth.hmac_key = os.getenv("SAHANA_HMAC_KEY", "akeytochange")
# Email settings
# Outbound server
settings.mail.server = os.getenv("SAHANA_MAIL_HOST", "127.0.0.1:25")
settings.mail.server = os.getenv("SAHANA_MAIL_HOST") or "127.0.0.1:25"
#settings.mail.tls = True
# Useful for Windows Laptops:
# https://www.google.com/settings/security/lesssecureapps
#settings.mail.server = "smtp.gmail.com:587"
#settings.mail.tls = True
#settings.mail.login = "username:password"
settings.mail.tls = True
settings.mail.login = os.getenv("SAHANA_MAIL_LOGIN") or False
# From Address - until this is set, no mails can be sent
settings.mail.sender = os.getenv("SAHANA_MAIL_SENDER", "'Sahana' <sahana@example.org>")
settings.mail.sender = os.getenv("SAHANA_MAIL_SENDER") or "'Sahana' <sahana@example.org>"
# Default email address to which requests to approve new user accounts gets sent
# This can be overridden for specific domains/organisations via the auth_domain table
settings.mail.approver = os.getenv("SAHANA_MAIL_APPROVER", "useradmin@example.org")
settings.mail.approver = os.getenv("SAHANA_MAIL_APPROVER") or "useradmin@example.org"
# Daily Limit on Sending of emails
#settings.mail.limit = 1000
@ -121,9 +121,9 @@ settings.mail.approver = os.getenv("SAHANA_MAIL_APPROVER", "useradmin@example.or
# GetAddress API Key (for GetAddress.io Postcode to Address lookup)
#settings.gis.api_getaddress = ""
# Google API Key (for Google Maps Layers)
settings.gis.api_google = os.getenv("SAHANA_API_KEY_GOOGLE", "")
settings.gis.api_google = os.getenv("SAHANA_API_KEY_GOOGLE") or ""
# OpenWeatherMap API Key (for OpenWeatherMap Layers)
settings.gis.api_openweathermap = os.getenv("SAHANA_API_KEY_OPENWEATHERMAP", "")
settings.gis.api_openweathermap = os.getenv("SAHANA_API_KEY_OPENWEATHERMAP") or ""
# GeoNames username
#settings.gis.geonames_username = ""