cncjs

Форк
0
/
settings.base.js 
181 строка · 4.8 Кб
1
import path from 'path';
2
import pkg from '../../package.json';
3

4
const RC_FILE = '.cncrc';
5
const SESSION_PATH = '.cncjs-sessions';
6

7
// Secret
8
const secret = pkg.version;
9

10
const getUserHome = () => (process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME']);
11

12
export default {
13
  rcfile: path.resolve(getUserHome(), RC_FILE),
14
  verbosity: 0,
15
  version: pkg.version,
16

17
  // The secret key is loaded from the config file (defaults to "~/.cncrc")
18
  // @see "src/app/index.js"
19
  secret: secret,
20

21
  // Access Token Lifetime
22
  accessTokenLifetime: '30d', // https://github.com/zeit/ms
23

24
  // Allow Remote Access
25
  allowRemoteAccess: false,
26

27
  // Express view engine
28
  view: {
29
    // Set html (w/o dot) as the default extension
30
    defaultExtension: 'html',
31

32
    // Format: <extension>: <template>
33
    engines: [
34
      { // Hogan template with .html extension
35
        extension: 'html',
36
        template: 'hogan'
37
      },
38
      { // Hogan template with .hbs extension
39
        extension: 'hbs',
40
        template: 'hogan'
41
      },
42
      { // Hogan template with .hogan extension
43
        extension: 'hogan',
44
        template: 'hogan'
45
      }
46
    ]
47
  },
48
  // Middleware (https://github.com/senchalabs/connect)
49
  middleware: {
50
    // https://github.com/expressjs/body-parser
51
    'body-parser': {
52
      'json': {
53
        // maximum request body size. (default: <100kb>)
54
        limit: '256mb'
55
      },
56
      'urlencoded': {
57
        extended: true,
58
        // maximum request body size. (default: <100kb>)
59
        limit: '256mb'
60
      }
61
    },
62
    // https://github.com/mscdex/connect-busboy
63
    'busboy': {
64
      limits: {
65
        fileSize: 256 * 1024 * 1024 // 256MB
66
      },
67
      // immediate
68
      //   false: no immediate parsing
69
      //   true: immediately start reading from the request stream and parsing
70
      immediate: false
71
    },
72
    // https://github.com/andrewrk/node-multiparty/
73
    'multiparty': {
74
      // Limits the amount of memory a field (not a file) can allocate in bytes. If this value is exceeded, an error event is emitted. The default size is 2MB.
75
      maxFieldsSize: 20 * 1024 * 1024, // 20MB
76

77
      // Limits the number of fields that will be parsed before emitting an error event. A file counts as a field in this case. Defaults to 1000.
78
      maxFields: 1000
79
    },
80
    // https://github.com/expressjs/morgan
81
    'morgan': {
82
      // The ':id' token is defined at app.js
83
      format: ':id \x1b[1m:method\x1b[0m \x1b[33m:url\x1b[0m \x1b[34m:status\x1b[0m :response-time ms'
84
    },
85
    // https://github.com/expressjs/compression
86
    'compression': {
87
      // response is only compressed if the byte size is at or above this threshold.
88
      threshold: 512
89
    },
90
    // https://github.com/expressjs/session
91
    'session': {
92
      path: path.resolve(getUserHome(), SESSION_PATH)
93
    }
94
  },
95
  siofu: { // SocketIOFileUploader
96
    dir: './tmp/siofu'
97
  },
98
  i18next: {
99
    lowerCaseLng: true,
100

101
    // logs out more info (console)
102
    debug: false,
103

104
    // language to lookup key if not found on set language
105
    fallbackLng: 'en',
106

107
    // string or array of namespaces
108
    ns: [
109
      'config',
110
      'resource' // default
111
    ],
112

113
    // default namespace used if not passed to translation function
114
    defaultNS: 'resource',
115

116
    whitelist: [
117
      'en', // English (default)
118
      'cs', // Czech
119
      'de', // German
120
      'es', // Spanish
121
      'fr', // French
122
      'hu', // Hungarian
123
      'it', // Italian
124
      'ja', // Japanese
125
      'nb', // Norwegian
126
      'nl', // Nederlands
127
      'pt-br', // Portuguese (Brazil)
128
      'pt-pt', // Portuguese (Portugal)
129
      'ru', // Russian
130
      'uk', // Ukraine
131
      'tr', // Turkish
132
      'zh-cn', // Simplified Chinese
133
      'zh-tw' // Traditional Chinese
134
    ],
135

136

137
    // array of languages to preload
138
    preload: [],
139

140
    // language codes to lookup, given set language is 'en-US':
141
    // 'all' --> ['en-US', 'en', 'dev']
142
    // 'currentOnly' --> 'en-US'
143
    // 'languageOnly' --> 'en'
144
    load: 'currentOnly',
145

146
    // char to separate keys
147
    keySeparator: '.',
148

149
    // char to split namespace from key
150
    nsSeparator: ':',
151

152
    interpolation: {
153
      prefix: '{{',
154
      suffix: '}}'
155
    },
156

157
    detection: {
158
      // order and from where user language should be detected
159
      order: ['session', 'querystring', 'cookie', 'header'],
160

161
      // keys or params to lookup language from
162
      lookupQuerystring: 'lang',
163
      lookupCookie: 'lang',
164
      lookupSession: 'lang',
165

166
      // cache user language
167
      caches: ['cookie']
168
    },
169

170
    backend: {
171
      // path where resources get loaded from
172
      loadPath: path.resolve(__dirname, '..', 'i18n', '{{lng}}', '{{ns}}.json'),
173

174
      // path to post missing resources
175
      addPath: path.resolve(__dirname, '..', 'i18n', '{{lng}}', '{{ns}}.savedMissing.json'),
176

177
      // jsonIndent to use when storing json files
178
      jsonIndent: 4
179
    }
180
  }
181
};
182

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.