@ismaillowkey/node-red-contrib-configpass 0.3.1
Node-RED utility nodes for project path detection, password hashing, Admin Editor & Dashboard security, PM2 management, network IP info, and auto redirect to dashboard
@ismaillowkey/node-red-contrib-configpass
English
A Node-RED palette package for Node-RED project utility & configuration management. It includes features for retrieving folder paths, hashing passwords, controlling Admin Editor & Dashboard Password, managing PM2 processes (pm2 list & pm2 action), obtaining network IP & Gateway information (get ip), and configuring web root redirection to dashboard (auto redirect to dashboard).
Nodes List in Palette
Category / Main Palette: Additional
1. get path node-red
Gets path folder information of the currently running Node-RED project.
Output (msg.payload)
An object containing:
userDir: Node-RED user directory path (e.g.,C:\Users\username\.node-red)cwd: Current working directory of the Node-RED processprojectDir: Active project directory path (if Node-RED Projects feature is enabled)flowFile: Name of the active flow filesettingsFile: Thesettings.jsfile path used by Node-RED
2. generate hash pw
Hashes a password. By default, it generates a bcrypt (8 salt rounds) hash which is 100% compatible with Node-RED's built-in command node-red admin hash-pw and adminAuth settings in settings.js.
Node Configuration
- Input Password: Input message property (default:
msg.payload) - Output Hash: Output message property (default:
msg.payload) - Algorithm:
bcrypt(default 8 salt rounds),sha256,sha512,md5,sha1 - Salt Rounds: Number of salt rounds for bcrypt (default:
8)
3. admin editor
Enables or disables the Node-RED Admin Editor automatically by updating the settings.js file. When enabled, password protection is mandatory.
Node Configuration
- Action:
Enable Admin Editor/Disable Admin Editor - Password Auth:
Enter Directly in Node/Via msg.payload / msg.password - Username: Admin username (default:
admin) - Admin Path: Editor root path when enabled (default:
/)
Output Format (msg.payload)
{
"status": true,
"message": "please restart node-red"
}
4. disable/enable dashboard password (or set pass dashboard flowfuse)
Enables or disables password protection on Node-RED Dashboard / FlowFuse Dashboard by configuring the httpNodeAuth option in settings.js.
Node Configuration
- Action:
Enable Dashboard Password/Disable Dashboard Password - Password Auth:
Enter Directly in Node/Via msg.payload / msg.password - Username: Dashboard username (default:
user)
Output Format (msg.payload)
{
"status": true,
"message": "please restart node-red"
}
5. pm2 list
Retrieves a list of currently running PM2 processes with their ID, Name, CPU usage, and Memory usage.
Output Format (msg.payload)
{
"status": true,
"message": "success",
"data": [
{
"id": 0,
"name": "my-app",
"cpu": 0.5,
"memory": 24538112,
"status": "online"
}
]
}
6. pm2 action
Runs PM2 actions (start, stop, restart) on a specific process based on process ID, Index, or Name.
Output Format (msg.payload)
{
"status": true,
"message": "pm2 restart 0 success"
}
7. get ip
Retrieves a list of active network interfaces along with their IP Address, Default Gateway, Interface Name, and Password.
Output Format (msg.payload)
{
"status": true,
"message": "success",
"data": [
{
"name": "Wi-Fi",
"ip": "192.168.2.129",
"gateway": "192.168.2.1",
"password": ""
}
]
}
8. auto redirect to dashboard
Configures the Node-RED Admin Editor URL path and automatically redirects root web access (/) to the dashboard page via settings.js.
Node Configuration
- Action:
Enable Auto Redirect to Dashboard/Disable Auto Redirect - Set Admin Page: Admin editor URL path (default:
/admin) - Open Web Redirect to Web: Destination dashboard URL path (default:
/dashboard/page1)
Note:
- For FlowFuse Dashboard:
/dashboard/page1- For Dashboard 1.0 (node-red-dashboard):
/ui
Output Format (msg.payload)
{
"status": true,
"message": "please restart node-red"
}
Example Flow
[
{
"id": "9774c0c25eb82c9c",
"type": "group",
"z": "013b72e1d574a0f6",
"name": "inject 1x and then restart node-red",
"style": {
"label": true
},
"nodes": [
"e7edf69ac509e949",
"3ff48696cd8ceadc",
"0d5115c10cda3398"
],
"x": 74,
"y": 459,
"w": 732,
"h": 82
},
{
"id": "e7edf69ac509e949",
"type": "open-web-redirect",
"z": "013b72e1d574a0f6",
"g": "9774c0c25eb82c9c",
"name": "",
"action": "enable",
"adminPage": "/admin",
"redirectUrl": "/dashboard/page1",
"x": 430,
"y": 500,
"wires": [
[
"0d5115c10cda3398"
]
]
},
{
"id": "3ff48696cd8ceadc",
"type": "inject",
"z": "013b72e1d574a0f6",
"g": "9774c0c25eb82c9c",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 170,
"y": 500,
"wires": [
[
"e7edf69ac509e949"
]
]
},
{
"id": "0d5115c10cda3398",
"type": "debug",
"z": "013b72e1d574a0f6",
"g": "9774c0c25eb82c9c",
"name": "debug 2",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 700,
"y": 500,
"wires": []
},
{
"id": "d02db8a338335825",
"type": "global-config",
"env": [],
"modules": {
"@ismaillowkey/node-red-contrib-configpass": "0.3.1"
}
}
]
Bahasa Indonesia
Package palet Node-RED untuk utilitas manajemen & konfigurasi proyek Node-RED, termasuk path folder, hashing password, pengontrol Admin Editor & Dashboard Password, manajemen proses PM2 (pm2 list & pm2 action), informasi IP Address & Gateway jaringan (get ip), serta pengalihan web root ke dashboard (auto redirect to dashboard).
Daftar Node dalam Palette
Kategori / Main Palette: Additional
1. get path node-red
Node untuk mendapatkan informasi path folder dari proyek Node-RED yang sedang berjalan.
Output (msg.payload)
Mengeluarkan objek path:
userDir: Path direktori user Node-RED (misal:C:\Users\username\.node-red)cwd: Current working directory dari proses Node-REDprojectDir: Path direktori proyek yang aktif (jika fitur Node-RED Projects diaktifkan)flowFile: Nama file flow yang sedang dibukasettingsFile: Filesettings.jsyang digunakan oleh Node-RED
2. generate hash pw
Node untuk meng-hash password. Secara default menghasilkan hash bcrypt (8 salt rounds) yang 100% kompatibel dengan perintah bawaan node-red admin hash-pw dan adminAuth pada settings.js.
Konfigurasi Node
- Input Password: Properti pesan input (default:
msg.payload) - Output Hash: Properti pesan output (default:
msg.payload) - Algorithm:
bcrypt(default 8 salt rounds),sha256,sha512,md5,sha1 - Salt Rounds: Jumlah salt rounds untuk bcrypt (default:
8)
3. admin editor
Node untuk mengaktifkan (enable) atau mematikan (disable) Admin Editor Node-RED secara otomatis melalui file settings.js. Saat di-enable, proteksi password wajib dikonfigurasi.
Konfigurasi Node
- Action:
Enable Admin Editor/Disable Admin Editor - Password Auth:
Ketik Langsung di Node/Lewat msg.payload / msg.password - Username: Username admin (default:
admin) - Admin Path: Path root editor ketika di-enable (default:
/)
Format Output (msg.payload)
{
"status": true,
"message": "please restart node-red"
}
4. disable/enable dashboard password (atau set pass dashboard flowfuse)
Node untuk mengaktifkan (enable) atau mematikan (disable) proteksi password pada Node-RED Dashboard / FlowFuse Dashboard melalui opsi httpNodeAuth pada settings.js.
Konfigurasi Node
- Action:
Enable Dashboard Password/Disable Dashboard Password - Password Auth:
Ketik Langsung di Node/Lewat msg.payload / msg.password - Username: Username dashboard (default:
user)
Format Output (msg.payload)
{
"status": true,
"message": "please restart node-red"
}
5. pm2 list
Node untuk mengambil daftar proses PM2 yang sedang berjalan beserta informasi ID, Nama, CPU usage, dan Memory usage.
Format Output (msg.payload)
{
"status": true,
"message": "success",
"data": [
{
"id": 0,
"name": "my-app",
"cpu": 0.5,
"memory": 24538112,
"status": "online"
}
]
}
6. pm2 action
Node untuk menjalankan perintah PM2 (start, stop, restart) pada proses tertentu berdasarkan ID, Index, atau Nama proses.
Format Output (msg.payload)
{
"status": true,
"message": "pm2 restart 0 success"
}
7. get ip
Node untuk mendapatkan daftar interface jaringan aktif beserta informasi IP Address, Default Gateway, Nama Interface, dan Password.
Format Output (msg.payload)
{
"status": true,
"message": "success",
"data": [
{
"name": "Wi-Fi",
"ip": "192.168.2.129",
"gateway": "192.168.2.1",
"password": ""
}
]
}
8. auto redirect to dashboard
Node untuk mengatur path URL Admin Editor Node-RED dan mengarahkan (redirect) akses web root (/) langsung ke halaman dashboard pada settings.js secara otomatis.
Konfigurasi Node
- Action:
Enable Auto Redirect to Dashboard/Disable Auto Redirect - Set Admin Page: Path URL Admin Editor (default:
/admin) - Open Web Redirect to Web: Path URL tujuan dashboard (default:
/dashboard/page1)
Catatan:
- Untuk FlowFuse Dashboard:
/dashboard/page1- Untuk Dashboard 1.0 (node-red-dashboard):
/ui
Format Output (msg.payload)
{
"status": true,
"message": "please restart node-red"
}
Contoh Flow
[
{
"id": "9774c0c25eb82c9c",
"type": "group",
"z": "013b72e1d574a0f6",
"name": "inject 1x and then restart node-red",
"style": {
"label": true
},
"nodes": [
"e7edf69ac509e949",
"3ff48696cd8ceadc",
"0d5115c10cda3398"
],
"x": 74,
"y": 459,
"w": 732,
"h": 82
},
{
"id": "e7edf69ac509e949",
"type": "open-web-redirect",
"z": "013b72e1d574a0f6",
"g": "9774c0c25eb82c9c",
"name": "",
"action": "enable",
"adminPage": "/admin",
"redirectUrl": "/dashboard/page1",
"x": 430,
"y": 500,
"wires": [
[
"0d5115c10cda3398"
]
]
},
{
"id": "3ff48696cd8ceadc",
"type": "inject",
"z": "013b72e1d574a0f6",
"g": "9774c0c25eb82c9c",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 170,
"y": 500,
"wires": [
[
"e7edf69ac509e949"
]
]
},
{
"id": "0d5115c10cda3398",
"type": "debug",
"z": "013b72e1d574a0f6",
"g": "9774c0c25eb82c9c",
"name": "debug 2",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 700,
"y": 500,
"wires": []
},
{
"id": "d02db8a338335825",
"type": "global-config",
"env": [],
"modules": {
"@ismaillowkey/node-red-contrib-configpass": "0.3.1"
}
}
]