Getting Started

Configuration

Elegant provides simple configuration settings straight out of the box so that you can customize your application as you see fit.

This guide will show you how to configure your Elegant application and provide detailed explanations of each configuration value.

Environment Configuration

It is often helpful to have different configuration values based on the environment where the application is running. For example, you may wish to use a different Google Analytics tag locally than you do on your production server.

To make this a cinch, Elegant utilizes a .env file located in the root-level directory of your application.

Environment File Security

Your .env file should not be committed to your application’s source control, since each developer/server using your application could require a different environment configuration. Furthermore, this would be a security risk if an intruder gains access to your source control repository since any sensitive credentials would get exposed.

Retrieving Environment Configuration

All of the variables listed in the .env file will be loaded into the process.env Node super-global variable when your application is built. However, you may use the env function to retrieve values from these variables in your configuration files.

To access the NEXT_PUBLIC_APP_NAME environment variable in your application, reference the super Node super-global environment variable:

let title = process.env.NEXT_PUBLIC_APP_NAME

**Note: **We have prefixed the environment variables within your .env file with NEXT_PUBLIC_ to make this application compatible with Vercel.com hosting and Next.js. For more information, please visit Vercel.com.