Skip to content

Environment Variables

INFO

The MicroPowerManager follows The Twelve-Factor App principle. MicroPowerManager's configuration is separated from the code base and can be done via environment variables.

In this document we describe the most relevant environment variables and highlight the ones which are required to be populated for MicroPowerManager to function properly.

Frontend

Backend connection

Environment VariableDefaultDescription
MPM_ENVRequiredEnvironment identifier for the MicroPowerManager frontend. Can be development, demo or production. Recommended to set to production in production environments. Note: This is different from the builtin NODE_ENV environment variable.
MPM_BACKEND_URLRequiredThe URL of the MicroPowerManager backend. For example http://localhost:8000 (for non-local) or https://demo-backend.micropowermanager.io (for production).

Backend

Because MicroPowerManager is based on Laravel and Laravel Plugins a lot of behaviour can be configured using environment variables.

For more details see the corresponding plugin's documentation.

Laravel

Environment VariableDefaultDescription
APP_NAMEMicroPowerManagerDisplay Name of the Application
APP_ENVdevelopmentEnvironment identifier for the MicroPowerManager backend. Can be development, demo or production. Recommended to set to production in production environments.
APP_DEBUGTrueWhether or not to run MicroPowerManager in debug mode. Recommended to set to false in production environments.
APP_KEYRequiredUsed by the Illuminate encrypter service to encrypt database entries. In production environments make sure this is a random, 32 character string, otherwise these encrypted strings will not be safe
APP_URLhttp://localhost:8000Set this to root of MicroPowerManager in deployed environments (production or demo).

MicroPowerManager

These environment variables control how the MicroPowerManager behaves as an application.

Environment VariableDefaultDescription
MPM_LOAD_DEMO_DATAfalseWhether or not the demo data should be loaded when the MicroPowerManager starts for the first time. Recommended for local development and demo environments. Optional for production environments.

JSON Web Token Authentication (jwt-auth)

For more details see jwt-auth documentation.

Environment VariableDefaultDescription
JWT_SECRETRequiredjwt-auht secret, ideally created with php artisan jwt:secret.

Database connection

Environment VariableDefaultDescription
DB_CONNECTIONmicro_power_managerName of the laravel default connection. Should almost never be changed.
DB_HOSTRequiredNetwork host name the database is accessible from. For example db (for local) or long-url.my-cloud-provider.com/region/db (for dedicated databases).
DB_PORT3306Database port.
DB_DATABASEmicro_power_managerDatabase name.
DB_USERNAMERequiredDatabase username. For example root.
DB_PASSWORDRequiredDatabase password. For example password123!

Redis connection

We recommend running MicroPowerManager with Redis.

Environment VariableDefaultDescription
REDIS_HOSTRequired (If Redis is used)Network host name the Redis cluster is accessible from. For example redis (for local) or long-url.my-cloud-provider.com/region/db (for dedicated Redis cluster).
REDIS_PASSWORDRequired (If Redis is used)Password for Redis.
REDIS_PORT6379

Caching

We recommend running MicroPowerManager with Redis for caching.

Environment VariableDefaultDescription
CACHE_DRIVERfileRecommended to set to redis.

Session management

Environment VariableDefaultDescription
SESSION_DRIVERfile
SESSION_LIFETIME120

Broadcasting

We recommend running MicroPowerManager with Pusher Channels for broadcasting.

Environment VariableDefaultDescription
BROADCAST_DRIVERnullRecommended to set to pusher.
PUSHER_APP_IDRequired (If Pusher is used)Pusher App id.
PUSHER_APP_KEYRequired (If Pusher is used)Pusher App key.
PUSHER_APP_SECRETRequired (If Pusher is used)Pusher App secret.
PUSHER_APP_CLUSTERRequired (If Pusher is used)Pusher App cluster. For example eu.

Queue

Environment VariableDefaultDescription
QUEUE_DRIVERsyncRecommended to set to database.
QUEUE_PAYMENTpaymentName of the payment queue.
QUEUE_ENERGYenergy_paymentName of the energy payment queue.
QUEUE_TOKENtokenName of the token queue.
QUEUE_SMSsmsName of the SMS queue.
QUEUE_HISTORYhistoryName of the History queue.
QUEUE_REPORTreport_generatorName of the Report Generator queue.
QUEUE_MISCmiscName of the miscellaneous queue.

Basic setup

Logging

Set of environment variables that can be used to configure logging and logging providers in MicroPowerManager.

Environment VariableDefaultDescription
LOG_CHANNELmpm_stackThe default value mpm_stack configures a split logging where error logs go to STDERR and application info and debug logs to STDOUT. Additional log channels to external logging solutions are automatically enabled, if corresponding environment variables are configured, see below. For more information about available log channels, see logging.php.
LOG_LEVELdebugGeneral log level of the application. Note, that external logging systems may define their log level seperately. For example, it might be desired to only send critical errors to Slack, even if MicroPowerManager runs with an elevanted log level of info. Recommended to set this at least info or hire in normal operations of a production environment.

Slack

Environment VariableDefaultDescription
LOG_SLACK_LEVELcriticalThe log level sent to Slack. URL
LOG_SLACK_WEBHOOK_URLRequired (When using Slack Logging)Slack Webhook URL. This require a Slack incoming webhook. If LOG_SLACK_WEBHOOK_URL is provided Slack logging will be enabled.
LOG_SLACK_USERNAMELaravel LogSlack Webhook Username
LOG_SLACK_EMOJI:boom:Slack Webhook Emoji

Email

Configure the following environment variable to enable MicroPowerManager to send email via SMTP. These configure instance level email sent to tenants, for example signup confirmation, password reset, etc...

Environment VariableDefaultDescription
MAIL_SMTP_HOSTsmtp.mailgun.orgMail server hostname. For example smtp.mailserver.com.
MAIL_SMTP_PORT587Mail server port.
MAIL_SMTP_ENCRYPTIONtlsMail encryption.
MAIL_SMTP_AUTHfalseWhether to use SMTP Auth.
MAIL_USERNAMERequired (when MAIL_SMTP_AUTH is true)The username used in SMTP Auth.
MAIL_PASSWORDRequired (when MAIL_SMTP_AUTH is true)The password used in SMTP Auth.
MAIL_SMTP_DEFAULT_SENDERRequiredThe email used in from and replyTo fields of sent email. Note: Depending on the mailserver this might be different from SMTP Auth username.
MAIL_SMTP_DEFAULT_MESSAGEPlease do not reply to this emailDefault message body of emails.
MAIL_SMTP_DEBUG_LEVEL0Debug level used in PHPMailer. 0 No output, 4 Noisy, low-level data output, rarely needed.

MPM Plugins

Certain MicroPowerManager plugins require configuration before they can be used. Find below a reference of configurations which are required if the corresponding plugin is used.

SunKing

For detailed information see SunKing Developer Documentation

Environment VariableDefaultDescription
SUNKING_API_URLRequired (when plugin is used)SunKing API URL. For example https://dev.assetcontrol.central.glp apps.com/v2.

WaveMoney

For detailed information see WaveMoney Developer Documentation

Environment VariableDefaultDescription
WAVEMONEY_API_URLRequired (when plugin is used)WaveMoney API URL. For example https://preprodpayments.wavemoney.io:8107.

Built with VitePress ❤️.