Skip to main content

Server Environment Variables

About 4 min...

You can customize Waline Server through the following environment variables.

Warning

You MUST redeploy after updating Environment variables to make changes applied.

You should set through Settings - Environment Variables when using Vercel.

Basic

Environment VariablesRequiredDescription
LEAN_IDLeanCloud Application ID
LEAN_KEYLeanCloud Application Key
LEAN_MASTER_KEYLeanCloud Application Master Key
LEAN_SERVERLeanCloud server address if you're leancloud china user
SITE_NAMEsite name
SITE_URLsite url
LOGINUser need login before comment when LOGIN=force

Display

Environment VariablesDefaultDescription
DISABLE_USERAGENTwether hide the user agent of commenter. Default value is false
DISABLE_REGIONwether hide commenter's region. Default value is false
DISABLE_AUTHOR_NOTIFYwether disable author notification
AVATAR_PROXYhttps://avatar.75cdn.workers.devAvatar proxy service url. You can set false to disable it
GRAVATAR_STRhttps://seccdn.libravatar.org/avatar/{{mail|md5}}Gravatar render string,base on nunjucks template
LEVELSGive each user a rating label based on the number of comments

Level Label

According number of user comments, a level label will be added to the commenter based on rating Conditions. This feature is disabled by default and can be enabled by setting the environment variable LEVELS. The configuration is in the form of a comma concatenation of a given number, for example 0,10,20,50,100,200 means:

GradesConditionsDefault Grade Labels
00 <= count < 10Dwarves
110 <= count < 20Hobbits
220 <= count < 50Ents
350 <= count < 100Wizards
4100 <= count < 200Elves
5200 <= countMaiar

In addition to customizing the level judgment rules, we can also customize the level label. Configure the text in the client as follows:

Waline.init({
  locale: {
    level0: 'Dwarves',
    level1: 'Hobbits',
    level2: 'Ents',
    level3: 'Wizards',
    level4: 'Elves',
    level5: 'Maiar',
  },
});

By default, only 6 levels of copywriting are provided, but it does not mean that there can only be 6 levels. The specific level cap is based on the level judgment rules you set. To add a new level, it is recommended to configure the label text corresponding to the level by yourself. If no label text is provided, the default label text such as Level 10 will be displayed by default.

Safety

Environment VariablesDefaultDescription
IPQPS60IP-based comment posting frequency limit in seconds. Set to 0 for no limit
SECURE_DOMAINSSecure Domains config. Supports multiple domain with Comma separated
AKISMET_KEY70542d86693eAkismet antispam service key, set false if you wanna close it.
COMMENT_AUDITfalseComment audit switcher. When enabled, every comment needs to be approved by admin, so hint in placeholder is recommended
RECAPTCHA_V3_KEYreCAPTCHA V3 key,should set along with client
RECAPTCHA_V3_SECRETreCAPTCHA V3 secret for server.
TURNSTILE_KEYTurnstile key,should set along with client
TURNSTILE_SECRETTurnstile secret for server

Recaptcha and Turnstile

Turnstile Key and Secret can be requested at https://www.cloudflare.com/products/turnstile/open in new window.

Recaptcha Key and Secret can be requested at https://www.google.com/recaptchaopen in new window.

When setting security domains, you need to add the site address and the Waline server address at the same time.

Markdown

Environment VariablesDefaultDescription
MARKDOWN_CONFIG{}MarkdownIt Config
MARKDOWN_HIGHLIGHTtrueWhether enable highlight
MARKDOWN_EMOJItrueWhether enable emoji
MARKDOWN_SUBtrueWhether enable subscript
MARKDOWN_SUPtrueWhether enable superscript
MARKDOWN_TEXmathjaxService to parse math, mathjax katex and false are supported
MARKDOWN_MATHJAX{}MathJax Options
MARKDOWN_KATEX{}KaTeX Options

Mail Service

The email service is used for email notification of user registration and comments. After configuring the variables related to the mail service, user registration will add operations related to email verification code confirmation to prevent malicious registration.

Environment variable nameRemarks
SMTP_SERVICESMTP mail service provider
SMTP_HOSTSMTP server address
SMTP_PORTSMTP server port
SMTP_USERSMTP username
SMTP_PASSSMTP Password.
SMTP_SECURESMTP connect with SSL
SENDER_NAMECustomize sender name
SENDER_EMAILCustomize sender email

Tips

Supported service providers can be found hereopen in new window. You can choose one of SMTP_SERVICE and (SMTP_HOST, SMTP_PORT). If you don't know the corresponding SMTP_SERVICE in the list, you need to configure SMTP_HOST and SMTP_PORT, which can probably be found in the mailbox settings.

The user name of SMTP usually supports the complete mailbox of the user, and the password is mostly the same as the mailbox password.

Please pay special attention that some mailboxes use separate SMTP passwords.

Database

MongoDB

Environment VariableRequiredDefaultDescription
MONGO_DBMongoDB database name
MONGO_USERMongoDB server username
MONGO_PASSWORDMongoDB server password
MONGO_HOST127.0.0.1MongoDB server address, support array format
MONGO_PORT27017MongoDB server port, support array format
MONGO_REPLICASETMongoDB replica set
MONGO_AUTHSOURCEMongoDB auth source
MONGO_OPT_SSLfalseuse SSL connection

MySQL

Environment VariableRequiredDefaultDescription
MYSQL_DBMySQL database name
MYSQL_USERMySQL server username
MYSQL_PASSWORDMySQL server password
MYSQL_HOST127.0.0.1MySQL server address
MYSQL_PORT3306MySQL server port
MYSQL_PREFIXwl_MySQL table prefix
MYSQL_CHARSETutf8mb4MySQL table charset
MYSQL_SSLfalsewhether use SSL connection

TiDB

Create a database on TiDB

Environment VariableRequiredDefaultDescription
TIDB_DBTiDB database name
TIDB_USERTiDB server username
TIDB_PASSWORDTiDB server password
TIDB_HOST127.0.0.1TiDB server address
TIDB_PORT4000TiDB server port
TIDB_PREFIXwl_TiDB table prefix
TIDB_CHARSETutf8mb4TiDB table charset

SQLite

Environment VariableRequiredDefaultDescription
SQLITE_PATHSQLite storage file path, not include file name
JWT_TOKENRandom String for login token generator
SQLITE_DBwalineSQLite storage file name, change it if your filename is not waline
SQLITE_PREFIXwl_SQLite table prefix

PostgreSQL

Environment VariableRequiredDefaultDescription
PG_DBPostgreSQL database name
PG_USERPostgreSQL server username
PG_PASSWORDPostgreSQL server password
PG_HOST127.0.0.1PostgreSQL server address
PG_PORT3211PostgreSQL server port
PG_PREFIXwl_PostgreSQL table prefix
PG_SSLfalseset to true to use SSL connection
POSTGRES_DATABASEalias for PG_DB
POSTGRES_USERalias for PG_USER
POSTGRES_PASSWORDalias for PG_PASSWORD
POSTGRES_HOST127.0.0.1alias for PG_HOST
POSTGRES_PORT3211alias for PG_PORT
POSTGRES_PREFIXwl_alias for PG_PREFIX
POSTGRES_SSLfalsealias for POSTGRES_SSL

GitHub

Environment VariableRequiredDefaultDescription
GITHUB_TOKENPersonal access tokensopen in new window
GITHUB_REPOrepository name, such as walinejs/waline
GITHUB_PATHThe data storage directory, such as data means it is stored in the data directory, root directory by default

Deta Base

Environment VariableRequiredDefaultDescription
DETA_PROJECT_KEYDeta project secret key

Advanced

Environment VariablesDefaultDescription
OAUTH_URLhttps://oauth.lithub.ccOAuth Social Login Service URL. You can build your own authopen in new window.
WEBHOOKYou can set a Webhook URL that will be triggered when you have new comment.
WALINE_ADMIN_MODULE_ASSET_URL//unpkg.com/@waline/adminWaline admin link
IP2REGION_DBcustomized IP query library path
TIPS: The comment area is only for demo. If you have any questions, please go to Github Discussion to ask.
What do you think?
  • 0
  • 0
  • 0
  • 0
  • 0
  • 0
Comments
  • Latest
  • Oldest
  • Hottest
Powered by Waline v3.1.3