CAROLINA DOCS


Disk

The "disk" app provides configuration for paths to key directories and, optionally, an browser-based file manager for admin users.

Configuration

The "disk" has a built-in config file with sane defaults. It looks like this:

module.exports = {

assetsDir: process.env.ASSETS_DIR || './assets',
filesDir: process.env.PRIVATE_FILES_DIR || './files',
publicDir: process.env.PUBLIC_FILES_DIR || './public',
resourceDir: process.env.RESOURCE_DIR || './resources',
srcDir: process.env.SRC_DIR || './src',
tempDir: process.env.TEMP_DIR || './.tmp',
templatesDir: process.env.TEMPLATES_DIR || './templates',

useAssetsAdmin: true,
useFilesAdmin: true,
usePublicAdmin: true,
useResourcesAdmin: true,
useTempAdmin: true,
useTemplatesAdmin: true
};

The first section defines the paths to key directories:

  • assets/: For static assets to be served such as css files, images, etc.
  • files/: For private files not under source control such as logs.
  • public/: For public files such as shareable uploads, etc. Not under source control.
  • resources/: For private files under source control.
  • src/: For front-end source files.
  • .tmp/: For temporary files.
  • templates/: For pug and other template files.

This means that you can use the "config" service to find the configured location for one of these directories:

let templatesDir = App.$config.get('disk', 'templatesDir');

The next section of the configuration determines whether or not to make any of those directories (except src/) accessible to admin users in the admin section of the site.

Publishable Files

You can publish the default disk config config/disk.js:

node . publish --config disk

Admin Routes

Browser-based file managers for some of the key project file directories (depending on configuration) are provided to admin users using express-file-manager.

They will be mounted at the following locations:

  • <admin_mount>/disk/assets/
  • <admin_mount>/disk/private/
  • <admin_mount>/disk/public/
  • <admin_mount>/disk/resources/
  • <admin_mount>/disk/temp/
  • <admin_mount>/disk/templates/

The admin mount point will be configured by config/routes.js, but by default it is /admin, so the assets file manager would be located at /admin/disk/assets.


CAROLINA DOCS