Allow to configure a lot more of options via env variables

This commit is contained in:
Jan Böhmer 2023-01-28 20:44:50 +01:00
parent 4ad40a22de
commit f2239e99d1
2 changed files with 83 additions and 59 deletions

102
.env
View file

@ -1,27 +1,10 @@
# In all environments, the following files are loaded if they exist,
# the later taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
# https://symfony.com/doc/current/configuration/secrets.html
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
#### Part-DB Configuration
# See https://github.com/Part-DB/Part-DB-symfony/wiki/Configuration for documentation of available options
###> symfony/framework-bundle ###
APP_ENV=prod
APP_SECRET=a03498528f5a5fc089273ec9ae5b2849
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
#TRUSTED_HOSTS='^(localhost|example\.com)$'
###< symfony/framework-bundle ###
###################################################################################
# Database settings
###################################################################################
###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
@ -31,29 +14,26 @@ DATABASE_URL="sqlite:///%kernel.project_dir%/var/app.db"
# Uncomment this line (and comment the line above to use a MySQL database
#DATABASE_URL=mysql://root:@127.0.0.1:3306/part-db?serverVersion=5.7
###< doctrine/doctrine-bundle ###
### Custom vars
###################################################################################
# General settings
###################################################################################
# The language to use serverwide as default (en, de, ru, etc.)
DEFAULT_LANG="en"
# The default timezone to use serverwide (e.g. Europe/Berlin)
DEFAULT_TIMEZONE="Europe/Berlin"
# The currency that is used inside the DB (and is assumed when no currency is set). This can not be changed later, so be sure to set it the currency used in your country
BASE_CURRENCY="EUR"
# The name of this installation. This will be shown as title in the browser and in the header of the website
INSTANCE_NAME="Part-DB"
# Allow users to download attachments to the server by providing an URL
# This could be a potential security issue, as the user can retrieve any file the server has access to (via internet)
ALLOW_ATTACHMENT_DOWNLOADS=0
FIXER_API_KEY=CHANGEME
# Change this to true, if no url rewriting (like mod_rewrite for Apache) is available
# In that case all URL contains the index.php front controller in URL
NO_URL_REWRITE_AVAILABLE=false
# Override value if you want to show to show a given text on homepage.
# When this is empty the content of config/banner.md is used as banner
BANNER=""
# In demo mode things it is not possible for a user to change his password and his settings.
DEMO_MODE=0
# Use gravatars for user avatars, when user has no own avatar defined
USE_GRAVATAR=0
###################################################################################
# Email related settings
# Email settings
###################################################################################
# The DSN of the email server that should be used for sending emails (disabled by default)
@ -63,16 +43,15 @@ MAILER_DSN=null://null
# The email address from which all Part-DB emails should be sent. Change this when you configure email!
EMAIL_SENDER_EMAIL=noreply@partdb.changeme
# The sender name which should be used for all Part-DB emails
EMAIL_SENDER_NAME="Part-DB Mailer"
# Set this to 1 to allow reset of a password per email
ALLOW_EMAIL_PW_RESET=0
######################################################################################
# History/Eventlog related settings
# History/Eventlog settings
######################################################################################
# If you want to use full timetrave functionality
# If you want to use full timetrave functionality all values below have to be set to 1
# Save which fields were changed in a ElementEdited log entry
HISTORY_SAVE_CHANGED_FIELDS=1
@ -81,7 +60,36 @@ HISTORY_SAVE_CHANGED_DATA=0
# Save the data of an element that gets removed into log entry. This allows to undelete an element
HISTORY_SAVE_REMOVED_DATA=0
###################################################################################
# Error pages settings
###################################################################################
###> symfony/mailer ###
# MAILER_DSN=null://null
###< symfony/mailer ###
# You can set an email address here, which is shown on an error page, how to contact an administrator
ERROR_PAGE_ADMIN_EMAIL=''
# If this is set to true, solutions to common problems are shown on error pages. Disable this, if you do not want your users to see them...
ERROR_PAGE_SHOW_HELP=1
######################################################################################
# Other settings
######################################################################################
# In demo mode things it is not possible for a user to change his password and his settings.
DEMO_MODE=0
# Change this to true, if no url rewriting (like mod_rewrite for Apache) is available
# In that case all URL contains the index.php front controller in URL
NO_URL_REWRITE_AVAILABLE=0
# If you want to use fixer.io for currency conversion, you have to set this to your API key
FIXER_API_KEY=CHANGEME
# Override value if you want to show to show a given text on homepage.
# When this is empty the content of config/banner.md is used as banner
BANNER=""
APP_ENV=prod
APP_SECRET=a03498528f5a5fc089273ec9ae5b2849
# Set the trusted IPs here, when using an reverse proxy
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
#TRUSTED_HOSTS='^(localhost|example\.com)$'

View file

@ -5,26 +5,26 @@ parameters:
######################################################################################################################
# Common
######################################################################################################################
partdb.locale: 'en' # The default language to use serverwide
partdb.timezone: 'Europe/Berlin' # The default timezone
partdb.title: 'Part-DB' # The title shown inside of Part-DB (e.g. in the navbar and on homepage)
partdb.locale: '%env(string:DEFAULT_LANG)%' # The default language to use serverwide
partdb.timezone: '%env(string:DEFAULT_TIMEZONE)%' # The default timezone
partdb.title: '%env(trim:string:INSTANCE_NAME)%' # The title shown inside of Part-DB (e.g. in the navbar and on homepage)
partdb.banner: '%env(trim:string:BANNER)%' # The info text shown in the homepage, if empty config/banner.md is used
partdb.default_currency: 'EUR' # The currency that is used inside the DB (and is assumed when no currency is set). This can not be changed later, so be sure to set it the currency used in your country
partdb.default_currency: '%env(string:BASE_CURRENCY)%' # The currency that is used inside the DB (and is assumed when no currency is set). This can not be changed later, so be sure to set it the currency used in your country
partdb.global_theme: '' # The theme to use globally (see public/build/themes/ for choices, use name without .css). Set to '' for default bootstrap theme
partdb.locale_menu: ['en', 'de', 'fr', 'ru', 'ja'] # The languages that are shown in user drop down menu
######################################################################################################################
# Users and Privacy
######################################################################################################################
partdb.gpdr_compliance: true # If this option is activated, IP addresses are anonymized to be GPDR compliant
partdb.users.use_gravatar: true # Set to false, if no Gravatar images should be used for user profiles.
partdb.users.email_pw_reset: '%env(validMailDSN:MAILER_DSN)%' # Config if users are able, to reset their password by email. By default this enabled, when a mail server is configured.
partdb.gpdr_compliance: true # If this option is activated, IP addresses are anonymized to be GPDR compliant
partdb.users.use_gravatar: '%env(bool:USE_GRAVATAR)%' # Set to false, if no Gravatar images should be used for user profiles.
partdb.users.email_pw_reset: '%env(bool:ALLOW_EMAIL_PW_RESET)%' # Config if users are able, to reset their password by email. By default this enabled, when a mail server is configured.
######################################################################################################################
# Mail settings
######################################################################################################################
partdb.mail.sender_email: 'noreply@partdb.changeme' # The email address from which all emails are sent from
partdb.mail.sender_name: 'Part-DB Mailer' # The name that will be used for all mails sent by Part-DB
partdb.mail.sender_email: '%env(string:EMAIL_SENDER_EMAIL)%' # The email address from which all emails are sent from
partdb.mail.sender_name: '%env(string:EMAIL_SENDER_NAME)%' # The name that will be used for all mails sent by Part-DB
######################################################################################################################
# Attachments and files
@ -36,8 +36,8 @@ parameters:
######################################################################################################################
# Error pages
######################################################################################################################
partdb.error_pages.admin_email: '' # You can set an email address here, which is shown on an error page, how to contact an administrator
partdb.error_pages.show_help: true # If this is set to true, solutions to common problems are shown on error pages. Disable this, if you do not want your users to see them...
partdb.error_pages.admin_email: '%env(trim:string:ERROR_PAGE_ADMIN_EMAIL)%' # You can set an email address here, which is shown on an error page, how to contact an administrator
partdb.error_pages.show_help: '%env(trim:string:ERROR_PAGE_SHOW_HELP)%' # If this is set to true, solutions to common problems are shown on error pages. Disable this, if you do not want your users to see them...
######################################################################################################################
# Sidebar
@ -58,8 +58,24 @@ parameters:
######################################################################################################################
# Env default values
######################################################################################################################
env(DEMO_MODE): 0
env(DEFAULT_LANG): 'en'
env(DEFAULT_TIMEZONE): 'Europe/Berlin'
env(INSTANCE_NAME): 'Part-DB'
env(BASE_CURRENCY): 'EUR'
env(USE_GRAVATAR): '0'
env(ALLOW_ATTACHMENT_DOWNLOADS): 0
env(ERROR_PAGE_ADMIN_EMAIL): ''
env(ERROR_PAGE_SHOW_HELP): 1
env(DEMO_MODE): 0
env(BANNER): ''
env(EMAIL_SENDER_EMAIL): 'noreply@partdb.changeme'
env(EMAIL_SENDER_NAME): 'Part-DB Mailer'
env(ALLOW_EMAIL_PW_RESET): 0
env(TRUSTED_PROXIES): '127.0.0.1' #By default trust only our own server
env(TRUSTED_HOSTS): '' # Trust all host names by default