feat(glpi): config moved to config node

this stores the condig in flows_cred.json file

!1
This commit is contained in:
2023-08-14 04:00:28 +00:00
parent d453b7f957
commit d4897a946b
2 changed files with 51 additions and 272 deletions

View File

@ -484,44 +484,18 @@
"e9127065159b9f0f",
"de01a4559aecf1c4",
"36cf43c754570ebd",
"1fb718bcdd65dc23",
"b73763bef878743f",
"a42b269766d80f74",
"842ade29052f7e66",
"330ab008da58ac93",
"957b63c9fc58a139",
"02812e8708980b09",
"e83ed4274d3959f3",
"271cd66b841705be",
"06b5d27bbf1e5b16",
"32d8df5c0bb564cb"
"32d8df5c0bb564cb",
"fb7fea44905cf7a4"
],
"x": 154,
"y": 39,
"w": 1732,
"h": 202
},
{
"id": "690ee27cf3eee484",
"type": "group",
"z": "42b9663b67dbd983",
"name": "Development: Create GLPI Config File",
"style": {
"stroke": "#0070c0",
"fill": "#b797cf",
"label": true,
"color": "#000000"
},
"nodes": [
"742f2f88646c543a",
"b54ff25c1e83a094",
"da2cb448945babee",
"d5627c7a12528006"
],
"x": 1314,
"y": 319,
"w": 772,
"h": 82
"y": 59,
"w": 1432,
"h": 182
},
{
"id": "3b247f5e5d90963e",
@ -2100,7 +2074,7 @@
"type": "junction",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"x": 1640,
"x": 1340,
"y": 140,
"wires": [
[
@ -2118,7 +2092,7 @@
"wires": [
[
"957b63c9fc58a139",
"330ab008da58ac93"
"fb7fea44905cf7a4"
]
]
},
@ -2996,7 +2970,7 @@
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1770,
"x": 1470,
"y": 200,
"wires": []
},
@ -3016,60 +2990,6 @@
]
]
},
{
"id": "1fb718bcdd65dc23",
"type": "watch",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "",
"files": "config.glpi.json",
"recursive": "",
"x": 920,
"y": 200,
"wires": [
[
"330ab008da58ac93"
]
]
},
{
"id": "b73763bef878743f",
"type": "file in",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "Open GLPI Config File",
"filename": "filename",
"filenameType": "msg",
"format": "utf8",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 1190,
"y": 200,
"wires": [
[
"a42b269766d80f74"
]
]
},
{
"id": "a42b269766d80f74",
"type": "json",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "",
"property": "payload",
"action": "obj",
"pretty": false,
"x": 1340,
"y": 200,
"wires": [
[
"842ade29052f7e66"
]
]
},
{
"id": "842ade29052f7e66",
"type": "change",
@ -3077,13 +2997,6 @@
"g": "b994fe21efb223a9",
"name": "global.config.glpi",
"rules": [
{
"t": "set",
"p": "config.glpi",
"pt": "global",
"to": "payload",
"tot": "msg"
},
{
"t": "set",
"p": "CurrentGlobalConfig",
@ -3097,7 +3010,7 @@
"from": "",
"to": "",
"reg": false,
"x": 1480,
"x": 1250,
"y": 200,
"wires": [
[
@ -3105,35 +3018,6 @@
]
]
},
{
"id": "330ab008da58ac93",
"type": "change",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "",
"rules": [
{
"t": "set",
"p": "filename",
"pt": "msg",
"to": "config.glpi.json",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1075,
"y": 200,
"wires": [
[
"b73763bef878743f"
]
],
"l": false
},
{
"id": "64c99b312f9c601c",
"type": "link out",
@ -3566,8 +3450,7 @@
"y": 420,
"wires": [
[
"46d8b11bdef459aa",
"719e034af3c723aa"
"46d8b11bdef459aa"
]
],
"icon": "font-awesome/fa-lock"
@ -3594,8 +3477,7 @@
"e282aea37a90acdc"
],
[
"5f2f87eeebd5bf6e",
"4ded783ceb23864d"
"5f2f87eeebd5bf6e"
]
],
"outputLabels": [
@ -3936,9 +3818,9 @@
"rules": [
{
"t": "set",
"p": "config.oauth",
"p": "CurrentGlobalConfig",
"pt": "msg",
"to": "config.oauth",
"to": "config",
"tot": "global"
}
],
@ -3955,58 +3837,6 @@
]
]
},
{
"id": "271cd66b841705be",
"type": "debug",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "Config read",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1640,
"y": 80,
"wires": []
},
{
"id": "4ded783ceb23864d",
"type": "debug",
"z": "379c65a27117b46c",
"name": "debug 156",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2070,
"y": 260,
"wires": []
},
{
"id": "719e034af3c723aa",
"type": "debug",
"z": "379c65a27117b46c",
"name": "debug 157",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1510,
"y": 280,
"wires": []
},
{
"id": "3dc07bb0a7d4f647",
"type": "link out",
@ -4023,6 +3853,43 @@
"icon": "font-awesome/fa-hand-stop-o",
"l": true
},
{
"id": "fb7fea44905cf7a4",
"type": "credentials",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "GLPI",
"props": [
{
"value": "config.glpi.api_url",
"type": "global"
},
{
"value": "config.glpi.authorization",
"type": "global"
},
{
"value": "config.glpi.app_token",
"type": "global"
},
{
"value": "config.glpi.category_id_automation_task",
"type": "global"
},
{
"value": "config.glpi.debug_on",
"type": "global"
}
],
"x": 1110,
"y": 200,
"wires": [
[
"842ade29052f7e66"
]
],
"info": "# GLPI Configuration\n\nThis node stores it's values within `flows_cred.json` and therefor takes advantage of encrypting the values.\n\n## Structure\n\n``` json\n\n{\n \"api_url\": \"http://glpi/apirest.php/\",\n \"authorization\": \"user_token ***\",\n \"app_token\": \"\",\n \"category_id_automation_task\": 0,\n \"debug_on\": false\n}\n\n```\n\n| item | type | description |\n|:---:|:---:|:---|\n| api_url | `string` | URL for the API `{protocol}://{domain}/apirest.php/` |\n| authorization | `string` | Auth token suffixed with `user_token` |\n| app_token | `string` | Application token |\n| category_id_automation_task | `int` | the category for this automation task to be applied to the ticket task |\n| debug_on | `bool` | Authentication Callback URL, this value must always be `{protocol}://{domain}/callback`. i.e. `http://127.0.0.1:1881/callback` |\n "
},
{
"id": "02c4b9524d361ade",
"type": "link in",
@ -4959,94 +4826,6 @@
"y": 240,
"wires": []
},
{
"id": "742f2f88646c543a",
"type": "template",
"z": "42b9663b67dbd983",
"g": "690ee27cf3eee484",
"name": "Content",
"field": "payload",
"fieldType": "msg",
"format": "json",
"syntax": "mustache",
"template": "{\n \"api_url\": \"http://glpi/apirest.php/\",\n \"authorization\": \"user_token W6Ay7cdu38KuQCpYaZw5E7fxk4q8dYSrz38EsPuK\",\n \"app_token\": \"SwiMCd61d6qcfCoFCziotpJgBafl15vQCdRwHJ47\",\n \"category_id_automation_task\": \"2\",\n \"debug_on\": false\n}",
"output": "json",
"x": 1580,
"y": 360,
"wires": [
[
"da2cb448945babee"
]
]
},
{
"id": "b54ff25c1e83a094",
"type": "inject",
"z": "42b9663b67dbd983",
"g": "690ee27cf3eee484",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 1430,
"y": 360,
"wires": [
[
"742f2f88646c543a"
]
]
},
{
"id": "da2cb448945babee",
"type": "file",
"z": "42b9663b67dbd983",
"g": "690ee27cf3eee484",
"name": "",
"filename": "config.glpi.json",
"filenameType": "str",
"appendNewline": true,
"createDir": false,
"overwriteFile": "true",
"encoding": "none",
"x": 1780,
"y": 360,
"wires": [
[
"d5627c7a12528006"
]
]
},
{
"id": "d5627c7a12528006",
"type": "debug",
"z": "42b9663b67dbd983",
"g": "690ee27cf3eee484",
"name": "Config Written",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1960,
"y": 360,
"wires": []
},
{
"id": "9d93b8dfe83bf3ca",
"type": "function",