dccadb713488916d24fd66e67a743435f58ec5c9
[osm/UI.git] / skyquake / framework / core / api_utils / constants.js
1 /*
2 *
3 * Copyright 2016 RIFT.IO Inc
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 /**
20 * constants module. Provides constants for use within the skyquake instance
21 * @module api_utils/constants
22 */
23
24 var constants = {};
25
26 constants.FOREVER_ON = true;
27 constants.HTTP_HEADERS = {
28 accept: {
29 data: {
30 'Accept': 'application/vnd.yang.data+json'
31 },
32 collection: {
33 'Accept': 'application/vnd.yang.collection+json'
34 }
35 },
36 content_type: {
37 data: {
38 'Content-Type': 'application/vnd.yang.data+json'
39 },
40 collection: {
41 'Content-Type': 'application/vnd.yang.collection+json'
42 }
43 }
44 };
45
46 // (Incomplete) set of expected HTTP response codes
47 constants.HTTP_RESPONSE_CODES = {
48 SUCCESS: {
49 OK: 200,
50 CREATED: 201,
51 ACCEPTED: 202,
52 NO_CONTENT: 204,
53 MOVED_PERMANENTLY: 301,
54 NOT_MODIFIED: 304
55 },
56 ERROR: {
57 BAD_REQUEST: 400,
58 UNAUTHORIZED: 401,
59 FORBIDDEN: 403,
60 NOT_FOUND: 404,
61 METHOD_NOT_ALLOWED: 405,
62 NOT_ACCEPTABLE: 406,
63 CONFLICT: 409,
64 INTERNAL_SERVER_ERROR: 500,
65 NOT_IMPLEMENTED: 501,
66 BAD_GATEWAY: 502,
67 SERVICE_UNAVAILABLE: 504,
68 HTTP_VERSION_UNSUPPORTED: 505
69
70 }
71 }
72 constants.SOCKET_BASE_PORT = 3500;
73 constants.SOCKET_POOL_LENGTH = 20;
74 constants.SERVER_PORT = process.env.SERVER_PORT || 8000;
75 constants.SECURE_SERVER_PORT = process.env.SECURE_SERVER_PORT || 8443;
76
77 module.exports = constants;