Skip to content

Configuration

paranarimasu edited this page Nov 26, 2022 · 38 revisions

Note: WIP. Please contact para in the Discord for corrections or missing information.


Here we will configure the application for our development environment.

This guide covers configurations that expose settings to the .env file. This guide does not provide an overview for all configuration files.

Database

These properties define the database connection used by the application. The setup guide can be found here.

We may want to make use of a Redis database for performing functions such as cache storing and rate limiting. Follow this guide to set up Redis.

REDIS_CLIENT defines the client that the application uses to interface with Redis. We recommend using predis for development environments and phpredis for staging and production environments.

REDIS_CLUSTER defines the name of the cluster we are using if configured. We do not configure clusters at this time, so this can be left to the default value redis.

REDIS_URL can be used to identify the name, host and port all-in-one. By default, we do not use this option and leave it as null.

REDIS_HOST defines the host of our Redis database. By default, we assume that Redis is running on the same machine.

REDIS_PASSWORD defines the password of our Redis database. By default, we do not assume that a password has been set. Please ensure that you set this value if you define a password for your database.

REDIS_PORT defines the port that the database runs on. By default, this port is 6379.

REDIS_SCHEME defines the URI used for the database connection. By default, we use the tcp scheme. We may optimize our connection in Linux environments if the database is running on the same machine by using sockets, in which case this property should be set to unix and the client property should be set to phpredis.

File: config/database.php

Feature Flags

These properties are the flags that toggle application features.

ALLOW_VIDEO_STREAMS

When video streams are allowed, requests to the video.show route will stream video. If disabled, requests to the video.show route will redirect the user to the welcome page.

If we do not have an access token to the video repository or own testing bucket, it is recommended to leave this value false. If set to true, we need to ensure that we have configured the needed properties for the videos disk in the config/filesystems.php file.

ALLOW_DISCORD_NOTIFICATIONS

When discord notifications are allowed, event listeners shall send discord notifications to the configured discord channel through the configured bot. If discord notifications are not allowed, event listeners shall not send discord notifications.

We may leave this as false if we do not want to dispatch discord notifications. If set to true, we need to ensure that we have configured the needed properties for the discord service in the config/services.php file AND the needed properties for our desired queue worker in config/queue.php to process the dispatched jobs to the configured service.

ALLOW_VIEW_RECORDING

When set to true, a view will be created for the viewable model in the show action of the resource controller. When set to false, a view will not be recorded. By default, this flag is set to false.

File: config/flags.php

Filesystems

These properties define "disks" that represent a particular storage driver and storage location. Configuration for drivers are detailed here.

We define an images disk and a videos disk in our application. These filesystems host our images and videos for streaming purposes. The guide to configure these filesystems can be found here.

File: config/filesystems.php

Nova

Nova is a code-driven administration panel that allows us to manage our repository.

NOVA_DOMAIN_NAME is the "domain name" associated with the application. This can be used to prevent Nova's internal routes from being registered on subdomains which do not need access to your admin application. We do not make use of subdomains in our application so we can leave this as null.

NOVA_GUARD defines the authentication guard that will be used to protect Nova routes. We can leave this as null to use the default auth guard.

NOVA_PASSWORDS defines the password broker that will be used when passwords are reset. We can leave this as null to use the default broker.

File: config/nova.php

Scout

Scout provides a simple, driver based solution for adding full-text search to our Eloquent models. Using model observers, Scout will automatically keep search indexes in sync with our Eloquent records.

By default, we set the property SCOUT_DRIVER to null to disable scout.

At the time of this writing, we support an Elasticsearch driver to interface with an Elasticsearch engine and its indices and documents. Follow this guide to configure Elasticsearch.

File: config/scout.php

Secure Headers

These settings toggle security header features that are injected into responses from the application. These are disabled by default as they may not be applicable for local environments.

ENABLE_CLEAR_SITE_DATA enables/disables Clear-Site-Data.

ENABLE_HSTS enables/disables HTTP Strict Transport Security. SSL/TLS setup is a required prerequisite.

ENABLE_EXPECT_CT enables/disables Expect_CT.

ENABLE_PERMISSIONS_POLICY enables/disables Permissions Policy.

ENABLE_CSP enables/disables Content Security Policy.

File: config/secure-headers.php

Services

These properties store credentials for third party services such as Mailgun, Postmark, AWS and more. We should review this file if configuring external services.

MAL_BEARER_TOKEN

Bearer HTTP authentication scheme token used for MAL API calls. This is used solely for seeding purposes, and the seeder will be pruned from the project on the deployment of the wiki release, so we can leave this null.

If, for some reason, we need to use this seeder, this script can be used to generate an access token.

DO_BEARER_TOKEN

Bearer HTTP authentication scheme token used for hosting API calls. This is needed for the transparency page, but can be left null unless work is being done specifically for this page.

File: config/services.php