Brightspot CMS Developer Guide

Storage item configuration


Dari provides the class for storing file-based data in a Brightspot project. An object that references a file must declare a StorageItem object, which represents the referenced file in the underlying file system or cloud service. Among other file-related information, a StorageItem object includes a path to the file that it represents.

A project’s storage item implementation must be configured. For the Tomcat servlet container, the context.xml file is used.

Storage locations are specified with the dari/storage/{storageName}/ namespace, where storageName is a unique string. Multiple storage locations can be configured with different storageName values, with the applicable storage location specified when you create a StorageItem object. You can also set a default storage location, where new StorageItem objects are stored automatically. (For information about default configurations, see Configuration identifiers, key prefixes, and defaults.)

The following example from a Tomcat context.xml file shows how a namespace is used to uniquely identify a storage location for file-based data. In this case, the storage location is identified as tutorial.source, and all configuration options for this storage location share the same namespace. Essentially, the following configuration directs a LocalStorageItem object to place all file-based data into a folder called .storage.

<!-- Storage -->
<Environment name="dari/storage/tutorial.source/class" type="java.lang.String" value="com.psddev.dari.util.LocalStorageItem"/>
<Environment name="dari/storage/tutorial.source/baseUrl" type="java.lang.String" value="http://localhost:9480/"/>
<Environment name="dari/storage/tutorial.source/rootPath" type="java.lang.String" value=".storage"/>
<Environment name="dari/defaultStorage" type="java.lang.String" value="tutorial.source"/>

You can copy file-based data from one Brightspot project to another with Dari’s Storage Item tool. The tool must be configured with source and destination storage locations. For example, to copy file-based data from a Brightspot project running on localhost to another Brightspot project running on a remote server named “brutus”, you would extend the above configuration with another storage location identified with a different namespace, in this case tutorial.target. When you run the tool, two storage locations will be available to select from: tutorial.source and tutorial.target.

<Environment name="dari/storage/tutorial.target/class" type="java.lang.String" value="com.psddev.dari.util.LocalStorageItem"/>
<Environment name="dari/storage/tutorial.target/baseUrl" type="java.lang.String" value="http://brutus:9480/"/>
<Environment name="dari/storage/tutorial.target/rootPath" type="java.lang.String" value=".storage"/>

Each storage item implementation has a different set of configurations options. Below are configuration options for two common implementations. LocalStorageItem represents files stored on a local disk. S3StorageItem represents file-based data stored on the Amazon S3 cloud service.

LocalStorageItem
Key Type Description
dari/storage/{storageName}/class java.lang.String Set to com.psddev.dari.util.LocalStorageItem for local file system storage.
dari/storage/{storageName}/rootPath java.lang.String Path to location to store files on the local file system.
dari/storage/{storageName}/baseUrl java.lang.String URL to the storage root defined by rootPath.
S3StorageItem
Key Type Description
dari/storage/{storageName}/class java.lang.String Set to com.psddev.dari.aws.S3StorageItem for Amazon S3 storage.
dari/storage/{storageName}/access java.lang.String The AWS Access Key ID (a 20-character, alphanumeric string). For example: AKIAIOSFODNN7EXAMPLE
dari/storage/{storageName}/secret java.lang.String The AWS Secret Access Key (a 40-character string). For example: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
dari/storage/{storageName}/bucket java.lang.String The name of the S3 bucket to store objects in.
dari/storage/{storageName}/baseUrl java.lang.String URL to the bucket root defined by bucket.
Previous Topic
Debug tools
Next Topic
Image editor configuration
Was this topic helpful?
Thanks for your feedback.
Our robust, flexible Design System provides hundreds of pre-built components you can use to build the presentation layer of your dreams.



Brightspot is packaged with content types that get you up and running in a matter of days, including assets, modules and landing pages.

Content types
Modules
Landing pages
Everything you need to know when creating, managing, and administering content within Brightspot CMS.

Dashboards
Publishing
Workflows
Admin configurations
A guide for installing, supporting, extending, modifying and administering code on the Brightspot platform.

Field types
Content modeling
Rich-text elements
Images
A guide to configuring Brightspot's library of integrations, including pre-built options and developer-configured extensions.

Google Analytics
Shopify
Apple News