Advertisement
NittyGritty

settings.js

Jan 9th, 2020
531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.49 KB | None | 0 0
  1. /**
  2. * Copyright JS Foundation and other contributors, http://js.foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. **/
  16.  
  17. // The `https` setting requires the `fs` module. Uncomment the following
  18. // to make it available:
  19. var fs = require("fs");
  20. var i2c = require("i2c-bus");
  21.  
  22. var mySettings;
  23. try {
  24. mySettings = require("/home/pi/.node-red/redvars.js");
  25. } catch(err) {
  26. mySettings = {};
  27. }
  28.  
  29. module.exports = {
  30. // the tcp port that the Node-RED web server is listening on
  31. uiPort: process.env.PORT || 1880,
  32.  
  33. // By default, the Node-RED UI accepts connections on all IPv4 interfaces.
  34. // The following property can be used to listen on a specific interface. For
  35. // example, the following would only allow connections from the local machine.
  36. //uiHost: "127.0.0.1",
  37.  
  38. // Retry time in milliseconds for MQTT connections
  39. mqttReconnectTime: 15000,
  40.  
  41. // Retry time in milliseconds for Serial port connections
  42. serialReconnectTime: 15000,
  43.  
  44. // Retry time in milliseconds for TCP socket connections
  45. //socketReconnectTime: 10000,
  46.  
  47. // Timeout in milliseconds for TCP server socket connections
  48. // defaults to no timeout
  49. //socketTimeout: 120000,
  50.  
  51. // Timeout in milliseconds for HTTP request connections
  52. // defaults to 120 seconds
  53. //httpRequestTimeout: 120000,
  54.  
  55. // The maximum length, in characters, of any message sent to the debug sidebar tab
  56. debugMaxLength: 1000,
  57.  
  58. // The maximum number of messages nodes will buffer internally as part of their
  59. // operation. This applies across a range of nodes that operate on message sequences.
  60. // defaults to no limit. A value of 0 also means no limit is applied.
  61. //nodeMaxMessageBufferLength: 0,
  62.  
  63. // To disable the option for using local files for storing keys and certificates in the TLS configuration
  64. // node, set this to true
  65. //tlsConfigDisableLocalFiles: true,
  66.  
  67. // Colourise the console output of the debug node
  68. //debugUseColors: true,
  69.  
  70. // The file containing the flows. If not set, it defaults to flows_<hostname>.json
  71. flowFile: 'flows.json',
  72.  
  73. // To enabled pretty-printing of the flow within the flow file, set the following
  74. // property to true:
  75. flowFilePretty: true,
  76.  
  77. // By default, credentials are encrypted in storage using a generated key. To
  78. // specify your own secret, set the following property.
  79. // If you want to disable encryption of credentials, set this property to false.
  80. // Note: once you set this property, do not change it - doing so will prevent
  81. // node-red from being able to decrypt your existing credentials and they will be
  82. // lost.
  83. //credentialSecret: "a-secret-key",
  84.  
  85. // By default, all user data is stored in the Node-RED install directory. To
  86. // use a different location, the following property can be used
  87. //userDir: '/home/nol/.node-red/',
  88.  
  89. // Node-RED scans the `nodes` directory in the install directory to find nodes.
  90. // The following property can be used to specify an additional directory to scan.
  91. //nodesDir: '/home/nol/.node-red/nodes',
  92.  
  93. // By default, the Node-RED UI is available at http://localhost:1880/
  94. // The following property can be used to specify a different root path.
  95. // If set to false, this is disabled.
  96. //httpAdminRoot: '/admin',
  97.  
  98. // Some nodes, such as HTTP In, can be used to listen for incoming http requests.
  99. // By default, these are served relative to '/'. The following property
  100. // can be used to specifiy a different root path. If set to false, this is
  101. // disabled.
  102. //httpNodeRoot: '/red-nodes',
  103.  
  104. // The following property can be used in place of 'httpAdminRoot' and 'httpNodeRoot',
  105. // to apply the same root to both parts.
  106. //httpRoot: '/red',
  107.  
  108. // When httpAdminRoot is used to move the UI to a different root path, the
  109. // following property can be used to identify a directory of static content
  110. // that should be served at http://localhost:1880/.
  111. //httpStatic: '/home/nol/node-red-static/',
  112.  
  113. // The maximum size of HTTP request that will be accepted by the runtime api.
  114. // Default: 5mb
  115. //apiMaxLength: '5mb',
  116.  
  117. // If you installed the optional node-red-dashboard you can set it's path
  118. // relative to httpRoot
  119. //ui: { path: "ui" },
  120.  
  121. // Securing Node-RED
  122. // -----------------
  123. // To password protect the Node-RED editor and admin API, the following
  124. // property can be used. See http://nodered.org/docs/security.html for details.
  125. //adminAuth: {
  126. // type: "credentials",
  127. // users: [{
  128. // username: "admin",
  129. // password: "$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN.",
  130. // permissions: "*"
  131. // }]
  132. //},
  133.  
  134. // To password protect the node-defined HTTP endpoints (httpNodeRoot), or
  135. // the static content (httpStatic), the following properties can be used.
  136. // The pass field is a bcrypt hash of the password.
  137. // See http://nodered.org/docs/security.html#generating-the-password-hash
  138. //httpNodeAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
  139. //httpStaticAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
  140.  
  141. // The following property can be used to enable HTTPS
  142. // See http://nodejs.org/api/https.html#https_https_createserver_options_requestlistener
  143. // for details on its contents.
  144. // See the comment at the top of this file on how to load the `fs` module used by
  145. // this setting.
  146. //
  147. //https: {
  148. // key: fs.readFileSync('privatekey.pem'),
  149. // cert: fs.readFileSync('certificate.pem')
  150. //},
  151.  
  152. // The following property can be used to cause insecure HTTP connections to
  153. // be redirected to HTTPS.
  154. //requireHttps: true
  155.  
  156. // The following property can be used to disable the editor. The admin API
  157. // is not affected by this option. To disable both the editor and the admin
  158. // API, use either the httpRoot or httpAdminRoot properties
  159. //disableEditor: false,
  160.  
  161. // The following property can be used to configure cross-origin resource sharing
  162. // in the HTTP nodes.
  163. // See https://github.com/troygoode/node-cors#configuration-options for
  164. // details on its contents. The following is a basic permissive set of options:
  165. //httpNodeCors: {
  166. // origin: "*",
  167. // methods: "GET,PUT,POST,DELETE"
  168. //},
  169.  
  170. // If you need to set an http proxy please set an environment variable
  171. // called http_proxy (or HTTP_PROXY) outside of Node-RED in the operating system.
  172. // For example - http_proxy=http://myproxy.com:8080
  173. // (Setting it here will have no effect)
  174. // You may also specify no_proxy (or NO_PROXY) to supply a comma separated
  175. // list of domains to not proxy, eg - no_proxy=.acme.co,.acme.co.uk
  176.  
  177. // The following property can be used to add a custom middleware function
  178. // in front of all http in nodes. This allows custom authentication to be
  179. // applied to all http in nodes, or any other sort of common request processing.
  180. //httpNodeMiddleware: function(req,res,next) {
  181. // // Handle/reject the request, or pass it on to the http in node by calling next();
  182. // // Optionally skip our rawBodyParser by setting this to true;
  183. // //req.skipRawBodyParser = true;
  184. // next();
  185. //},
  186.  
  187. // The following property can be used to verify websocket connection attempts.
  188. // This allows, for example, the HTTP request headers to be checked to ensure
  189. // they include valid authentication information.
  190. //webSocketNodeVerifyClient: function(info) {
  191. // // 'info' has three properties:
  192. // // - origin : the value in the Origin header
  193. // // - req : the HTTP request
  194. // // - secure : true if req.connection.authorized or req.connection.encrypted is set
  195. // //
  196. // // The function should return true if the connection should be accepted, false otherwise.
  197. // //
  198. // // Alternatively, if this function is defined to accept a second argument, callback,
  199. // // it can be used to verify the client asynchronously.
  200. // // The callback takes three arguments:
  201. // // - result : boolean, whether to accept the connection or not
  202. // // - code : if result is false, the HTTP error status to return
  203. // // - reason: if result is false, the HTTP reason string to return
  204. //},
  205.  
  206. // Anything in this hash is globally available to all functions.
  207. // It is accessed as context.global.
  208. // eg:
  209. // // functionGlobalContext: { os:require('os') }
  210. // can be accessed in a function block as:
  211. // context.global.os
  212.  
  213. // functionGlobalContext: {
  214. // os:require('os'),
  215. // octalbonescript:require('octalbonescript'),
  216. // jfive:require("johnny-five"),
  217. // j5board:require("johnny-five").Board({repl:false})
  218. // },
  219.  
  220. // The following property can be used to order the categories in the editor
  221. // palette. If a node's category is not in the list, the category will get
  222. // added to the end of the palette.
  223. // If not set, the following default order is used:
  224. //paletteCategories: ['subflows', 'input', 'output', 'function', 'social', 'mobile', 'storage', 'analysis', 'advanced'],
  225.  
  226. // Configure the logging output
  227. logging: {
  228. // Only console logging is currently supported
  229. console: {
  230. // Level of logging to be recorded. Options are:
  231. // fatal - only those errors which make the application unusable should be recorded
  232. // error - record errors which are deemed fatal for a particular request + fatal errors
  233. // warn - record problems which are non fatal + errors + fatal errors
  234. // info - record information about the general running of the application + warn + error + fatal errors
  235. // debug - record information which is more verbose than info + info + warn + error + fatal errors
  236. // trace - record very detailed logging + debug + info + warn + error + fatal errors
  237. // off - turn off all logging (doesn't affect metrics or audit)
  238. level: "info",
  239. // Whether or not to include metric events in the log output
  240. metrics: false,
  241. // Whether or not to include audit events in the log output
  242. audit: false
  243. }
  244. }
  245. ,
  246.  
  247. httpStatic: '/home/pi/.node-red/public',
  248. functionGlobalContext: {
  249. os:require('os'),
  250. moment:require('moment'),
  251. fs:require('fs'),
  252. i2c:require('i2c-bus'),
  253. mySettings:mySettings
  254. },
  255.  
  256. adminAuth: {
  257. type: "credentials",
  258. users: [{
  259. username: "admin",
  260. password: "$2a$08$/wUnObApQ6CvwOjS4MzlRemp4/iUD7bLPQ3/lyYOJ.Pbwpz2MpW",
  261. permissions: "*"
  262. }]
  263. },
  264.  
  265. httpNodeAuth: {user:"user", pass:"$2a$08$xM65fkGUeEMSb6HCkVaie.nFGMC.8uAVneOEAakDsgEfKCQxPeq"}
  266. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement