aboutsummaryrefslogtreecommitdiff
path: root/config/config.js
blob: 5a1f79364def66e2a3879d45469b283bc3aa6c19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'use strict';

const Path = require('path');
const Getenv = require('getenv');

const internals = {
  blogDirectory: Getenv('BLOG_DIRECTORY', Path.resolve(Path.join(__dirname, '../.blog'))),
};

/**
 * The main configuration object for Blog. It will be used to
 * initialize all of the sub-components. It can extend any property of
 * the blog object.
 *
 * @memberof Blog
 * @typedef {object} tConfiguration
 * @property {number} maxPosts=3 the max number of posts that can exist
 * at one time
 * @property {string} postsDirectory=<project_root>/.posts the location of
 * the directory where the posts will be stored.
 * @property {string} staticDirectory=<project_root>/static the location of
 * the directory where the generated files will be placed. NOTE: There
 * are some pre-built style files in the default directory, if you
 * select another one, make sure you include them manually.
 * @property {string} templatesDirectory=<project_root>/templates the
 * location of the templates we'll use to generate the index.html
 */
module.exports = internals.Config = {
  maxPosts: Getenv.int('BLOG_MAX_POSTS', 3),
  blogDirectory: internals.blogDirectory,
  postsDirectory: Getenv('BLOG_POSTS_DIRECTORY', Path.resolve(Path.join(internals.blogDirectory, 'posts'))),
  archiveDirectory: Getenv('BLOG_ARCHIVE_DIRECTORY', Path.resolve(Path.join(internals.blogDirectory, 'archive'))),
  staticDirectory: Getenv('BLOG_STATIC_DIRECTORY', Path.resolve(Path.join(__dirname, '../static'))),
  templatesDirectory: Getenv('BLOG_TEMPLATES_DIRECTORY', Path.resolve(Path.join(__dirname, '../templates'))),
  remoteConfig: Getenv('BLOG_REMOTE_CONFIG', Path.resolve(Path.join(__dirname, '../.blogremote'))),
};