Configuration
All of the configuration files for the Dracory framework are stored in the config directory. Each option is documented, so feel free to look through the files and get familiar with the options available to you.
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 database locally than you do on your production server.
To make this a cinch, Dracory utilizes the .env file. A .env.example file is included with the framework, which contains common environment variables. During the Dracory installation process, this file will automatically be copied to .env.
Configuration Files
Dracory's configuration files are located in the config directory. These files allow you to configure things like your database connection information, mail server information, as well as various other core configuration values such as your application timezone and encryption key.
App Configuration
The config/config.go file contains the main configuration options such as the application name, timezone, database connections, and others.
It also contains the configuration for the stores - i.e user store, cache store, etc.
Store Configuration
Each store has its own configuration file, which initializes the store with the necessary configuration options, and is also used for the store migrations.
Accessing Configuration Values
You can easily access configuration values within your application using the config package:
import "project/config"
# Get the application name
appName := config.AppName
Configuration Caching
Configuration is read once during application startup and remains in memory throughout the app's lifecycle. Since all configuration values are stored in memory, there's no need for caching. This means:
- No need for caching - configuration is already fast to access
- Configuration can be changed at any time during development without any performance impact
- Changes to configuration files require a restart of the application to take effect