1 | /*
|
2 | * OS.js - JavaScript Cloud/Web Desktop Platform
|
3 | *
|
4 | * Copyright (c) 2011-2020, Anders Evenrud <andersevenrud@gmail.com>
|
5 | * All rights reserved.
|
6 | *
|
7 | * Redistribution and use in source and binary forms, with or without
|
8 | * modification, are permitted provided that the following conditions are met:
|
9 | *
|
10 | * 1. Redistributions of source code must retain the above copyright notice, this
|
11 | * list of conditions and the following disclaimer
|
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
|
13 | * this list of conditions and the following disclaimer in the documentation
|
14 | * and/or other materials provided with the distribution
|
15 | *
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
20 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
26 | *
|
27 | * @author Anders Evenrud <andersevenrud@gmail.com>
|
28 | * @licence Simplified BSD License
|
29 | */
|
30 |
|
31 | const path = require('path');
|
32 | const maxAge = 60 * 60 * 12;
|
33 | const mb = m => m * 1024 * 1024;
|
34 |
|
35 | const defaultConfiguration = {
|
36 | development: !(process.env.NODE_ENV || '').match(/^prod/i),
|
37 | logging: true,
|
38 | index: 'index.html',
|
39 | hostname: 'localhost',
|
40 | port: 8000,
|
41 | public: null,
|
42 | morgan: 'tiny',
|
43 | express: {
|
44 | maxFieldsSize: mb(20),
|
45 | maxFileSize: mb(200)
|
46 | },
|
47 | https: {
|
48 | enabled: false,
|
49 | options: {
|
50 | key: null,
|
51 | cert: null
|
52 | }
|
53 | },
|
54 | ws: {
|
55 | port: null,
|
56 | ping: 30 * 1000
|
57 | },
|
58 | proxy: [
|
59 | /*
|
60 | {
|
61 | source: 'pattern',
|
62 | destination: 'pattern',
|
63 | options: {}
|
64 | }
|
65 | */
|
66 | ],
|
67 | auth: {
|
68 | vfsGroups: [],
|
69 | defaultGroups: [],
|
70 | requiredGroups: [],
|
71 | requireAllGroups: false,
|
72 | denyUsers: []
|
73 | },
|
74 | mime: {
|
75 | filenames: {
|
76 | // 'filename': 'mime/type'
|
77 | 'Makefile': 'text/x-makefile',
|
78 | '.gitignore': 'text/plain'
|
79 | },
|
80 | define: {
|
81 | // 'mime/type': ['ext']
|
82 | 'text/x-lilypond': ['ly', 'ily'],
|
83 | 'text/x-python': ['py'],
|
84 | 'application/tar+gzip': ['tgz']
|
85 | }
|
86 | },
|
87 | session: {
|
88 | store: {
|
89 | module: require.resolve('connect-loki'),
|
90 | options: {
|
91 | autosave: true
|
92 | //ttl: maxAge
|
93 | }
|
94 | },
|
95 | options: {
|
96 | name: 'osjs.sid',
|
97 | secret: 'osjs',
|
98 | rolling: true,
|
99 | resave: false,
|
100 | saveUninitialized: false,
|
101 | cookie: {
|
102 | secure: 'auto',
|
103 | maxAge: 1000 * maxAge
|
104 | }
|
105 | }
|
106 | },
|
107 | packages: {
|
108 | // Resolves to root by default
|
109 | discovery: 'packages.json',
|
110 |
|
111 | // Resolves to dist/ by default
|
112 | metadata: 'metadata.json'
|
113 | },
|
114 |
|
115 | vfs: {
|
116 | watch: false,
|
117 | root: path.join(process.cwd(), 'vfs'),
|
118 |
|
119 | mountpoints: [{
|
120 | name: 'osjs',
|
121 | attributes: {
|
122 | root: '{root}/dist',
|
123 | readOnly: true
|
124 | }
|
125 | }, {
|
126 | name: 'home',
|
127 | attributes: {
|
128 | root: '{vfs}/{username}'
|
129 | }
|
130 | }]
|
131 | }
|
132 | };
|
133 |
|
134 | module.exports = {
|
135 | defaultConfiguration
|
136 | };
|
137 |
|