Configuration


Table of Contents
  1. Configuring the .env file
  2. Configuring the config.json

Configuring the .env file

.env config file should be located in your project web root folder.

Photon CMS is shipped with a .env.example config file, which is a good starting point.

Let's step through the various options:

#main
APP_ENV=local
APP_DEBUG=true
APP_KEY=secret
APP_NAME="Photon CMS"
APPLICATION_URL=photoncms.test

APP_ENV is a Laravel config parameter, serving the purpose of determining the application environment. Read more about the APP_ENV parameter in the Laravel official documentation.

APP_DEBUG is another Laravel config parameter, which defines the error reporting detail level. Read more about the APP_DEBUG parameter in the Laravel official documentation.

APP_KEY is a unique Laravel application key. You can generate a new key during the installation process, or at any other time, using the Artisan command php artisan key:generate.

APP_NAME is the name of your Laravel application.

APPLICATION_URL sets the application URL.

CAN_RESET_PHOTON=true
CAN_REGISTER_USER=true

CAN_RESET_PHOTON option determines if a hard or soft Photon reset is possible. Make sure to set this option to false in your production environment!

CAN_REGISTER_USER determines if new user registration should be allowed or not.

DB_HOST=localhost
DB_DATABASE=dbname
DB_USERNAME=username
DB_PASSWORD=password

These are the various database connection-related parameters.

QUEUE_DRIVER=redis

QUEUE_DRIVER determines which queue driver should be used. Queues are very important in Photon CMS, as queues are used to handle all notifications, including ones sent via email.

#mailserver
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

Various mail-sending-related settings.

# Sender emails
[email protected]
[email protected]
[email protected]
[email protected]

Various 'from' email address settings.

JWT_TOKEN_TTL=2880

Photon CMS RESTful API uses JWT method for user authorization. JWT_TOKEN_TTL parameter determines a token time-to-live value in seconds.

# Broadcasting
BROADCAST_DRIVER=pusher
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

Photon CMS is set to use Pusher services for push notifications. These are the various Pusher connection parameters.

# Throttle
THROTTLE_MAX_TIMES=60
THROTTLE_COOLDOWN_MINUTES=5

THROTTLE_MAX_TIMES sets a parameter of maximum allowed attempts per minute that are allowed a single user to query any single API call.

THROTTLE_COOLDOWN_MINUTES sets a number of minutes a user will be forbidden from making repeated API calls, after crossing the threshold set by the THROTTLE_MAX_TIMES parameter.

# Exporting
EXPORTED_FILES_TTL=60

EXPORTED_FILES_TTL sets a time-to-live parameter in seconds, which defines how long will the files generated for download be available to a user, after they were requested by the provided API call.

# FCM notification broadcasting
FCM_SERVER_KEY=
FCM_SENDER_ID=

Photon CMS provides  a support for sending notifications via the Fire Cloud Messaging. These are the FCM connection parameters.

# Redis
REDIS_HOST=localhost
#REDIS_PASSWORD=
REDIS_PORT=6379

These are the various Redis connection parameters.

# Subscription
SUBSCRIPTION_TIME=30

SUBSCRIPTION_TIME represents a time-to-live parameter in minutes for module entry subscription. Photon CMS subscriptions is essentially a mechanism that will inform users if any other user is trying to edit the same module entry as they do.

IMAGE_SOFTWARE=GD
# IMAGE_SOFTWARE=Imagick

IMAGE_SOFTWARE sets a default image software selection. By default, PHP GD Library is available in most if not all server installations. However, Imagick Library provides far better quality, and we strongly suggest you to use it. Note that Imagick Library is not installed in most server setups.

CACHE_DRIVER=file
USE_PHOTON_CACHING=0
PHOTON_CACHING_TTL=60

CACHE_DRIVER setting determines which driver should be used for caching. We strongly suggest to use Redis as a caching solution, as Photon CMS uses caching tags to invalidate parts of cache. Tags are not available if you use file cache driver.

USE_PHOTON_CACHING determines if Photon CMS should cache the returned results or not. Turning the caching on will greatly improve the response times.

PHOTON_CACHING_TTL determines a time-to-live period in minutes for all cached objects. 

MASS_AUTO_UPDATE_ANCHOR=1

MASS_AUTO_UPDATE_ANCHOR settings determines if Anchor Text and Anchor HTML values should be rebuilt when either updating Anchor templates via the Generator, or when updating a value in a related module that is used in an anchor template.

Make sure to disable mass auto update when you have e.g. tens of thousands of records in your database, as automatic rebuild could potentially lock-up your system in a long-performing query.

When you disable anchor template mass auto update, you should use the provided Artisan command that you can run from the command line:

php artisan photon:rebuild-resized-images or php artisan photon:rebuild-resized-images module_table_name to update only certain modules.

PHOTON_STORE_LOGS=1
PHOTON_MAX_DAILY_LOGS=30

PHOTON_STORE_LOGS determines if all API calls should be logged in the /storage/logs/photon/ folder. 

User passwords are not stored in the log!

The logs are rotated daily and the PHOTON_MAX_DAILY_LOGS parameter tells how many logs should be kept (e.g. 30 days).

USE_REGISTRATION_SERVICE_EMAIL=0

USE_REGISTRATION_SERVICE_EMAIL If set to true a user is required to confirm her email address.

REGISTRATION_DEFAULT_ROLE=2

REGISTRATION_DEFAULT_ROLE determines a default role ID for all newly registered users.

CELEBRITY_RECOGNITION=1
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=us-west-2

CELEBRITY_RECOGNITION boolean parameter determines if Photon CMS celebrity recognition feature will be used or not. AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_REGION parameters should be obtained from you AWS account. Please refer to this document in order to start using AWS Rekognition service.

Configuring the config.json

To set-up the various Vue.js application parameters that are used in your Photon CMS Control Panel installation, you should edit the /resources/assets/photonCms/dependencies/js/config/config.json file.

After editing the file, make sure to run the 'npm run production' command in your project root directory to rebuild the javascript application.

Let's step through the options of the config.json file:


{
    "assetManager": {
        "itemsPerPage": 20,
        "preselectedImageSizeIndex": 0,
        "useMultipleFileUploader": false
    },
    "companySubtitle": "CONTENT MANAGEMENT",
    "companyTitle": "Photon",
    "defaultModuleIcon": "fa fa-file-o",
    "dateFormat": "MMM Do YYYY h:mm:ssa",
    "env": {
        "default": {
            "apiBasePath": "/api",
            "controlPanelBase": "cp",
            "debug": true,
            "name": "development",
            "production": false,
            "pusher": {
                "key": "xxxxx",
                "cluster": "eu"
            },
            "websiteBasePath": ""
        }
    },
    "inlineFieldTypes": [
        "Gallery",
        "ManyToManyExtended",
        "ManyToOneExtended",
        "OneToManyExtended",
        "OneToOneExtended",
        "RichText"
    ],
    "locale": "en",
    "massEditingDisabled": false,
    "moduleTypes": {
        "single_entry": "Single Entry",
        "non_sortable": "Non Sortable",
        "sortable": "Sortable",
        "multilevel_sortable": "Multilevel Sortable"
    },
    "paginatedNodesItemsPerPage": 25,
    "searchItemsPerPage": 25,
    "select2MatchType": "begins_with",
    "signUpEnabled": true,
    "spellcheck": false,
    "startPage": "/"
}

The "assetManager" object determines the settings for the Asset Manager Cotrol Panel feature:

  • "itemsPerPage" determines the number of asset items that will be loaded per lazy-load API call
  • "preselectedImageSizeIndex" determines the index of an Image Size entry that will be pre-selected by default when entering the Image Sizes editor inside the Asset Manager window.
  • "useMultipleFileUploader" settings is no longer used.

"companySubtitle" and "companyTitle" determine the values used in the Control Panel Welcome screen.

"defaultModuleIcon" sets the value for the icon that will be used as a default in Photon CMS generator.

"dateFormat" sets the date and time format used. Photon CMS Control Panel uses Moment.js library. Learn more about available date formats in official Moment.js library documentation.

The "env" object determines the environments for your application. You can have multiple environments that have different settings, and which will be used depending on which domain you're running the application. If no env parameters match the current domain name, the "default" settings will be used.

  • "apiBasePath" determines the base path for the API
  • "controlPanelBase" determines the base URL path for the Control Panel
  • "debug" if set to true, application will output various logs to the browser console
  • "name" sets the app name
  • "production" determines if the app is in production environment or not
  • "pusher" sets the Pusher push notifications service connection parameters
  • "websiteBasePath" sets the base path of the Photon CMS installation

"inlineFieldTypes" array holds the names of Photon CMS fields which should be rendered inline in a module form.

"locale" sets the application locale, and determines which locale file will be used. Locale files reside in /resources/assets/photonCms/core/js/i18n/ folder.

"massEditingDisabled" determines if the Mass Editing feature should be disabled or not.

"moduleTypes" sets the default Photon CMS module types.

"paginatedNodesItemsPerPage" setting determines how many items will be pulled from the API when using the sidebar menu lazy-loading feature. This setting applies only for the Non Sortable Photon CMS module type.

"searchItemsPerPage" determines how many items will be pulled per page when using the Photon CMS Control Panel Advanced Search feature.

"select2MatchType" determines which filter rule should be used when searching through the entries. Learn more about available filter rules in Photon CMS API documentation.

"signUpEnabled" determines if new user registration should be allowed or not.

"spellcheck" determines if spell checking browser feature should be enabled in rich text fields.

"startPage" determines the start page to which the user is taken after she logs in.

Sign-up to stay informed about news and updates.