Table of Contents
- Settings
- Introduction
- Environment variables called at compile time
- Environment variables called at runtime
- DB_CONNECTION :string = "sqlite"
- DB_USER :string = ""
- DB_PASSWORD :string = ""
- DB_DATABASE :string = ""
- DB_MAX_CONNECTION :int = 1
- LOG_IS_DISPLAY :bool = true
- LOG_IS_FILE :bool = true
- LOG_IS_ERROR_FILE :bool = true
- LOG_DIR :string = getCurrentDir() / "logs"
- SESSION_DB_PATH :string = getCurrentDir() / "session.db"
- SESSION_TIME :int = 20160
- ENABLE_ANONYMOUS_COOKIE :bool = true
- COOKIE_DOMAINS :string = ""
- HOST :string = "0.0.0.0"
- LOCALE :string = "en"
Basolato settings is defined as environment variables in those of config.nims
, .env
, .env.local
, ~/.bash_rc
, ~/.bash_profile
and so on.
Environment variables defined in .env
can only be called at application runtime.
You should set common settings for various environments in .env
, and environment-specific or sensitive DB connection information in .env.local
.
Note that config.nims
and .env.local
are not Git-managed by .gitignore
.
To apply changes, you have to do re-compile.
24 characters key which is used for encryption session id.
RDB driver which your system uses. Options are sqlite
, mysql
or postgres
.
Session DB type which your system uses. Options are file
or redis
.
sample
putEnv("SECRET_KEY", "abcdefghijklmnopqrstuvwx")
putEnv("DB_DRIVER", "sqlite") # "sqlite" or "mysql" or "postgres"
putEnv("SESSION_TYPE", "file") # "file" or "redis"
To apply changes, you have to re-run application.
The location of the RDB to connect to, either the absolute path of the file if you are using Sqlite, or host:port
if you are using MySQL or PostgreSQL.
The user name for connecting to the RDB.
The passsword for connecting to the RDB.
The db name for connecting to the RDB.
The number of connection pools to create when making asynchronous connections to the RDB.
If your application runs in multi-threaded mode, make sure that the number should be "number of possible connections / number of threads".
Set it to true
if you want the log to be displayed on the terminal, or false
if you don't want it.
Set the value to true
to output the log to a file, or false
if you don't want to.
Set the value to true
to output the error log to a file, or false
if you don't want to.
The absolute path of the log output destination directory.
The location of the session DB to connect to.
Set the absolute path of the file if you use file sessions, or host:port
if you use Redis.
Set a time limit in minutes for the session to time out.
Set it to true
if you want to generate cookies to anonymous users, or false
if you don't.
Set the target domain for issuing cookies.
Hostname to run server.
Language which you want to display validation message in.
language | LOCALE |
---|---|
English | en |
Japanese | ja |
sample .env
# Logging
LOG_IS_DISPLAY=true # true or false
LOG_IS_FILE=true # true or false
LOG_IS_ERROR_FILE=true # true or false
LOG_DIR="/root/project/logs"
# Session db
# Session type is defined in config.nims
SESSION_DB_PATH="/root/project/session.db" # Session file path or redis host:port. ex:"127.0.0.1:6379"
SESSION_TIME=20160 # minutes of 2 weeks
ENABLE_ANONYMOUS_COOKIE=true # true or false
COOKIE_DOMAINS="" # to specify multiple domains, "sample.com, sample.org"
# Other options
HOST="127.0.0.1"
LOCALE=en
sample .env.local
# DB Connection
# DB type is defined in config.nims
DB_CONNECTION="/root/project/db.sqlite3" # sqlite file path or host:port
DB_USER=""
DB_PASSWORD=""
DB_DATABASE=""
DB_MAX_CONNECTION=95 # should be smaller than (DB max connection / running threads num)