Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support .env config #1184

Open
ahmedkamalio opened this issue Feb 26, 2022 · 1 comment · May be fixed by #1185
Open

Support .env config #1184

ahmedkamalio opened this issue Feb 26, 2022 · 1 comment · May be fixed by #1185
Labels
enhancement New feature or request

Comments

@ahmedkamalio
Copy link

It's a very common practice to use a .env file to load server configuration instead of the config.json file, that being said, this issue suggests to add support to loading config from .env file.

an example .env file would be as follows

[DB_CLIENTS]
RDBMS=postgresql
HOST=127.0.0.1
PORT=5432
DBNAME= postgres
USER=postgres
PASSWD=""
IS_FAST=true
NUMBER_OF_CONNECTIONS=1
TIMEOUT=-1.0

[REDIS_CLIENTS]
HOST=127.0.0.1
PORT=6379
PASSWD=""
DB=0
IS_FAST=true
NUMBER_OF_CONNECTIONS=1
TIMEOUT=-1.0

[LISTENERS]
ADDRESS=0.0.0.0
PORT=80
HTTPS=false

[LISTENERS]
ADDRESS=0.0.0.0
PORT=443
HTTPS=true
CERT=""
KEY=""
USE_OLD_TLS=false

[APP]
NUMBER_OF_THREADS=0
ENABLE_SESSION=true
SESSION_TIMEOUT=0
DOCUMENT_ROOT="./"
USE_IMPLICIT_PAGE=false
UPLOAD_PATH="uploads"
MAX_CONNECTIONS=100000
MAX_CONNECTIONS_PER_IP=0
LOAD_DYNAMIC_VIEWS=false
ENABLE_UNICODE_ESCAPING_IN_JSON=true
RUN_AS_DAEMON=false
HANDLE_SIG_TERM=true
RELAUNCH_ON_ERROR=true
USE_SENDFILE=true
USE_GZIP=true
USE_BROTLI=false
STATIC_FILES_CACHE_TIME=0
IDLE_CONNECTION_TIMEOUT=30
SERVER_HEADER_FIELD=drogon/version
ENABLE_SERVER_HEADER=true
ENABLE_DATE_HEADER=true
KEEPALIVE_REQUESTS=0
PIPELINING_REQUESTS=0
GZIP_STATIC=true
BR_STATIC=true
CLIENT_MAX_BODY_SIZE=1M
CLIENT_MAX_MEMORY_BODY_SIZE=64K
CLIENT_MAX_WEBSOCKET_MESSAGE_SIZE=128K
REUSE_PORT=true

[LOG]
LOG_PATH=""
LOGFILE_BASE_NAME=drogon
LOG_SIZE_LIMIT=10000000 # 10MB
LOG_LEVEL=DEBUG

this's the equivalent of the config.json file created with new dragon project.

@ahmedkamalio ahmedkamalio linked a pull request Feb 26, 2022 that will close this issue
@rbugajewski rbugajewski added the enhancement New feature or request label Feb 28, 2022
@rbugajewski
Copy link
Collaborator

Thanks for the feature request.

Could you please clarify one question: Do you suggest that Drogon should adopt the INI file format in addition to JSON, or do you suggest that Drogon should support all configuration parameters via environment variables, and the .env file would be a means to an end for feeding the framework with variables?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants