File size: 2,318 Bytes
b2d5d3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/**
 * Einswarm Node-RED settings for Hugging Face Space.
 * Password hash injected by entrypoint via NODE_RED_ADMIN_PASSWORD_HASH.
 */
const adminUser = process.env.NODE_RED_ADMIN_USER || "admin";
const adminHash = process.env.NODE_RED_ADMIN_PASSWORD_HASH || "";
const credentialSecret =
  process.env.NODE_RED_CREDENTIAL_SECRET ||
  process.env.NODE_RED_CREDENTIAL_SECRET_KEY ||
  "";

const uiPort = parseInt(process.env.PORT || process.env.NODE_RED_PORT || "1880", 10);

module.exports = {
  uiPort,
  uiHost: "127.0.0.1",
  httpAdminRoot: "/",
  httpNodeRoot: "/",
  userDir: "/data",
  flowFile: process.env.FLOWS || "flows.json",
  flowFilePretty: true,
  credentialSecret: credentialSecret || undefined,

  httpNodeCors: {
    origin: "*",
    methods: "GET,PUT,POST,DELETE,OPTIONS"
  },

  adminAuth: adminHash
    ? {
        type: "credentials",
        users: [
          {
            username: adminUser,
            password: adminHash,
            permissions: "*"
          }
        ]
      }
    : undefined,

  editorTheme: {
    page: {
      title: "Einswarm Node-RED",
      favicon: "/einswarm/einswarm-logo.png",
      css: "/einswarm/einswarm-editor.css",
      scripts: ["/einswarm/bmc-loader.js"]
    },
    header: {
      title: "Einswarm Node-RED",
      image: "/einswarm/einswarm-logo.png",
      url: "https://huggingface.co/spaces/2Btainment/node-red"
    },
    deployButton: {
      type: "simple",
      label: "Deploy",
      icon: null
    },
    menu: {
      "menu-item-help": {
        label: "Einswarm / ANLEITUNG",
        url: "https://huggingface.co/spaces/2Btainment/node-red/blob/main/ANLEITUNG.md"
      }
    },
    userMenu: true,
    login: {
      image: "/einswarm/einswarm-logo.png"
    },
    logout: {
      redirect: "https://huggingface.co/spaces/2Btainment/node-red"
    },
    projects: { enabled: false },
    codeEditor: {
      lib: "monaco",
      options: { theme: "vs-dark" }
    }
  },

  functionGlobalContext: {
    einswarm: { brand: "Einswarm", owner: "2Btainment" }
  },

  logging: {
    console: { level: "info", metrics: false, audit: false }
  },

  exportGlobalContextKeys: false,
  externalModules: { autoInstall: false },

  // Serve /einswarm/* for any direct asset requests
  httpStatic: "/einswarm",
  httpStaticRoot: "/einswarm/"
};