UNPKG

5.59 kBJavaScriptView Raw
1const SCHEMA = {
2 api: {
3 menu: {
4 default: [],
5 doc: 'Collection menu ordering and grouping',
6 format: Array
7 },
8 host: {
9 default: '0.0.0.0',
10 format: String,
11 showToUnauthenticatedUsers: true
12 },
13 port: {
14 default: 80,
15 format: 'port',
16 showToUnauthenticatedUsers: true
17 }
18 },
19 app: {
20 name: {
21 default: 'Edit Interface',
22 doc: 'The applicaton name',
23 format: String
24 }
25 },
26 cdn: {
27 publicUrl: {
28 default: null,
29 doc: 'The host of the URL where the CDN instance can be publicly reached',
30 format: '*'
31 }
32 },
33 env: {
34 doc: 'The applicaton environment.',
35 format: String,
36 default: 'development',
37 env: 'NODE_ENV'
38 },
39 formats: {
40 date: {
41 long: {
42 default: 'YYYY/MM/DD HH:mm',
43 doc: 'Date Format',
44 format: String
45 },
46 short: {
47 default: 'YYYY/MM/DD',
48 doc: 'Date Format',
49 format: String
50 }
51 }
52 },
53 healthcheck: {
54 enabled: {
55 default: true,
56 doc: 'Healthcheck is enabled',
57 format: Boolean,
58 showToUnauthenticatedUsers: true
59 },
60 frequency: {
61 default: 2000,
62 doc: 'Interval between health checks, in milliseconds',
63 format: function check(val) {
64 if (isNaN(val)) {
65 throw new Error(
66 'Healthcheck frequency must be a valid number and greater than 1000'
67 )
68 }
69
70 if (val < 1000) {
71 throw new Error(
72 'Healthcheck frequency must be greater than 1000 milliseconds'
73 )
74 }
75 },
76 showToUnauthenticatedUsers: true
77 }
78 },
79 logging: {
80 enabled: {
81 doc: 'If true, logging is enabled using the following settings.',
82 format: Boolean,
83 default: true
84 },
85 level: {
86 doc: 'Sets the logging level.',
87 format: ['debug', 'info', 'warn', 'error', 'trace'],
88 default: 'info'
89 },
90 path: {
91 doc: 'The absolute or relative path to the directory for log files.',
92 format: String,
93 default: './log'
94 },
95 filename: {
96 doc: 'The name to use for the log file, without extension.',
97 format: String,
98 default: 'publish'
99 },
100 extension: {
101 doc: 'The extension to use for the log file.',
102 format: String,
103 default: 'log'
104 },
105 accessLog: {
106 enabled: {
107 doc:
108 'If true, HTTP access logging is enabled. The log file name is similar to the setting used for normal logging, with the addition of "access". For example `publish.access.log`.',
109 format: Boolean,
110 default: true
111 }
112 }
113 },
114 publicUrl: {
115 host: {
116 doc:
117 'The host of the URL where the Publish instance can be publicly reached',
118 format: '*',
119 default: null,
120 env: 'URL_HOST'
121 },
122 port: {
123 doc:
124 'The port of the URL where the Publish instance can be publicly reached',
125 format: '*',
126 default: null,
127 env: 'URL_PORT'
128 },
129 protocol: {
130 doc:
131 'The protocol of the URL where the Publish instance can be publicly reached',
132 format: 'String',
133 default: 'http',
134 env: 'URL_PROTOCOL'
135 }
136 },
137 server: {
138 host: {
139 doc: 'The IP address or interface to bind to',
140 format: 'ipaddress',
141 default: '0.0.0.0'
142 },
143 port: {
144 doc: 'The port to bind to',
145 format: 'port',
146 default: 3001
147 },
148 protocol: {
149 doc: 'The protocol the application will use',
150 format: String,
151 default: 'http',
152 env: 'PROTOCOL'
153 },
154 redirectPort: {
155 doc: 'Port from which to redirect HTTP connections to HTTPS',
156 format: 'port',
157 default: 0
158 },
159 sslCertificatePath: {
160 doc: 'The path to a SSL certificate',
161 format: String,
162 default: '',
163 env: 'SSL_CERTIFICATE_PATH'
164 },
165 sslIntermediateCertificatePath: {
166 doc: 'The path to a SSL intermediate certificate, if any',
167 format: String,
168 default: '',
169 env: 'SSL_INTERMEDIATE_CERTIFICATE_PATH'
170 },
171 sslIntermediateCertificatePaths: {
172 doc:
173 'The paths to SSL intermediate certificates, overrides sslIntermediateCertificate (singular)',
174 format: Array,
175 default: [],
176 env: 'SSL_INTERMEDIATE_CERTIFICATE_PATHS'
177 },
178 sslPassphrase: {
179 doc: 'The passphrase of the SSL private key',
180 format: String,
181 default: '',
182 env: 'SSL_PRIVATE_KEY_PASSPHRASE'
183 },
184 sslPrivateKeyPath: {
185 doc: 'The path to a SSL private key',
186 format: String,
187 default: '',
188 env: 'SSL_PRIVATE_KEY_PATH'
189 }
190 },
191 whitelabel: {
192 backgroundImage: {
193 default: 'bg.png',
194 doc: 'The background image URL',
195 format: String,
196 showToUnauthenticatedUsers: true
197 },
198 displayVersionNumber: {
199 default: true,
200 doc:
201 'Whether to display the version of the application in the navigation menu',
202 format: Boolean,
203 showToUnauthenticatedUsers: true
204 },
205 logoDark: {
206 default: 'images/logo-dark.svg',
207 doc: 'The URL of the logo to be used on light backgrounds',
208 format: String,
209 showToUnauthenticatedUsers: true
210 },
211 logoLight: {
212 default: 'images/logo-light.svg',
213 doc: 'The URL of the logo to be used on dark backgrounds',
214 format: String,
215 showToUnauthenticatedUsers: true
216 },
217 poweredBy: {
218 default: false,
219 doc: 'Whether to include a "Powered by DADI Publish" section',
220 format: Boolean,
221 showToUnauthenticatedUsers: true
222 }
223 }
224}
225
226module.exports = SCHEMA