Skip to content
On this page

Configure your Server

In this document, you’ll learn what configurations you can add to your Arialshop server and how to change them.

Prerequisites

This document assumes you already have installed Arialshop.

Arialshop Configurations File

There are 4 configuration files and are located inside api/src/config/index.js, core/src/config/index.js, admin/src/lib/config/index.js, store-front/src/lib/config/index.js. This includes Database, Redis, Search among other configurations.

Environment Variables

In your configurations, you’ll often use environment variables. For example, when using API keys or setting your database URL.

By default, Arialshop loads environment variables from the system’s environment variables. Any different method you prefer to use or other location you’d prefer to load environment variables from you need to manually implement.

Database Configuration

Arialshop supports MongoDB database and it is configured through .env file inside /api and /core directory

bash
MONGO_URI=<YOUR_DATABASE_URL>

Where <YOUR_DATABASE_URL> is the URL of your MongoDB database.

Redis

Arialshop uses Redis to handle the session management, among other usages. You need to set Redis URL in the configurations:

bash
REDIS_URI=<YOUR_REDIS_URL>

Where <YOUR_REDIS_URL> is the URL of your Redis server.

Session Secret

Arialshop uses session based authentication to handle user authentication. SESSION_SECRET is defined from envirnoment variables To set the session secret:

bash
SESSION_SECRET=<YOUR_SESSION_SECRET>

CORS Configurations

Arialshop uses Cross-Origin Resource Sharing (CORS) to only allow specific origins to access the server.

The Admin and the Core have different CORS configurations that must be configured.

Accepted Patterns

For both of the Admin and the Core CORS configurations, the value is expected to be a string. This string can be a comma-separated list of accepted origins. Every origin in that list can be of the following types:

  1. The accepted origin as is. For example, http://localhost:3000.
  2. A regular expression pattern that can match more than one origin. For example, *.example.com. The regex pattern that the server tests for is ^([\/~@;%#'])(.*?)\1([gimsuy]*)$.

More details about cors configuration is defined inside Core Config

Where CORS is the URL of your admin, storefront dashboard. By default, it’s http://localhost:3000,http://localhost:3001.

See Also