281 lines
6.6 KiB
JSON
281 lines
6.6 KiB
JSON
{
|
|
"module": "brother",
|
|
"version": "1",
|
|
"requires": [
|
|
"s3-bucket"
|
|
],
|
|
"binds": {
|
|
"s3-bucket": "${dir:state}/store-binding.json"
|
|
},
|
|
"secrets": {
|
|
"s3-bucket": "${dir:state}/store.secret"
|
|
},
|
|
"config": {
|
|
"scanner": {
|
|
"type": "string",
|
|
"description": "The network scanner's eSCL address, such as http://192.0.2.10/eSCL: the scanner's own address and the path its eSCL service answers on; the operator's, with no default.",
|
|
"pattern": "^https?://.+",
|
|
"trusted": true,
|
|
"required": true
|
|
},
|
|
"scan-folder": {
|
|
"type": "string",
|
|
"description": "The absolute path of the folder the scans are filed in as PDF files; the module makes it when it files the first scan, and never touches a file in it that it did not write. The operator's, with no default.",
|
|
"pattern": "^/.+$",
|
|
"trusted": true,
|
|
"required": true
|
|
},
|
|
"printer": {
|
|
"type": "string",
|
|
"description": "The printer's host, such as 192.0.2.10: where its admin page (HTTPS) and its IPP service answer. The device is the scanner's own; the operator's, with no default.",
|
|
"pattern": "^[A-Za-z0-9.:-]+$",
|
|
"trusted": true,
|
|
"required": true
|
|
},
|
|
"printer-certificate": {
|
|
"type": "string",
|
|
"description": "The SHA-256 fingerprint of the certificate the printer's admin page serves, as 32 upper-case hex pairs joined by colons; several, separated by commas, when the printer serves more than one (it serves an ECDSA and an RSA certificate for one name). The module trusts those certificates alone and refuses any other; the operator's, with no default.",
|
|
"pattern": "^([0-9A-F]{2}:){31}[0-9A-F]{2}(, *([0-9A-F]{2}:){31}[0-9A-F]{2})*$",
|
|
"trusted": true,
|
|
"required": true
|
|
},
|
|
"resolution": {
|
|
"type": "number",
|
|
"description": "The resolution asked of the scanner, in dpi: 100, 200, 300 or 600. A scanner may give another; the scan is filed at the resolution it gave.",
|
|
"enum": [
|
|
100,
|
|
200,
|
|
300,
|
|
600
|
|
],
|
|
"trusted": false,
|
|
"default": 300
|
|
},
|
|
"color-mode": {
|
|
"type": "string",
|
|
"description": "Whether the scan is in colour or in grays: color or gray.",
|
|
"enum": [
|
|
"color",
|
|
"gray"
|
|
],
|
|
"trusted": false,
|
|
"default": "color"
|
|
},
|
|
"crop": {
|
|
"type": "boolean",
|
|
"description": "Whether the document is cut out of the platen's white lid; false files the whole platen. A feeder scan is never cropped.",
|
|
"trusted": false,
|
|
"default": true
|
|
}
|
|
},
|
|
"own-secrets": {
|
|
"admin-password": {
|
|
"path": "${dir:state}/admin-password.secret",
|
|
"issued-by": "outside",
|
|
"prompt": "the admin password of the Brother printer",
|
|
"owner": "brother-device"
|
|
},
|
|
"broker-device": {
|
|
"path": "${dir:state}/broker-device.secret",
|
|
"owner": "brother-device"
|
|
}
|
|
},
|
|
"streams": [
|
|
{
|
|
"name": "device-asks",
|
|
"events": [
|
|
"device.asked"
|
|
],
|
|
"max-age-days": 1,
|
|
"max-mib": 8,
|
|
"retention": "work-queue",
|
|
"max-deliveries": 3,
|
|
"duplicates": 24
|
|
}
|
|
],
|
|
"state": [
|
|
{
|
|
"name": "device-answers",
|
|
"ttl-seconds": 600
|
|
}
|
|
],
|
|
"seats": [
|
|
{
|
|
"name": "scanner",
|
|
"scope": "mesh",
|
|
"serves": [
|
|
"scan",
|
|
"status",
|
|
"list",
|
|
"document"
|
|
]
|
|
},
|
|
{
|
|
"name": "printer",
|
|
"scope": "mesh",
|
|
"serves": [
|
|
"status",
|
|
"settings",
|
|
"print",
|
|
"upload"
|
|
]
|
|
}
|
|
],
|
|
"claims": [
|
|
{
|
|
"name": "scanner",
|
|
"scope": "mesh",
|
|
"serves": [
|
|
"scan",
|
|
"status",
|
|
"list",
|
|
"document"
|
|
]
|
|
},
|
|
{
|
|
"name": "printer",
|
|
"scope": "mesh",
|
|
"serves": [
|
|
"status",
|
|
"settings",
|
|
"print",
|
|
"upload"
|
|
]
|
|
}
|
|
],
|
|
"emits": [
|
|
"scan.added"
|
|
],
|
|
"tools": [
|
|
"scanner.scan",
|
|
"scanner.status",
|
|
"scanner.list",
|
|
"scanner.document",
|
|
"printer.status",
|
|
"printer.settings",
|
|
"printer.print",
|
|
"printer.upload",
|
|
"brother_health"
|
|
],
|
|
"resources": [
|
|
{
|
|
"id": "account",
|
|
"type": "user",
|
|
"name": "brother-device",
|
|
"shell": "/usr/bin/nologin"
|
|
},
|
|
{
|
|
"id": "state",
|
|
"type": "directory",
|
|
"mode": "0711",
|
|
"owner": "${machine:account}",
|
|
"place": ".",
|
|
"unknown": "program"
|
|
},
|
|
{
|
|
"id": "settings",
|
|
"type": "file",
|
|
"path": "${dir:state}/settings.json",
|
|
"owner": "${machine:account}",
|
|
"mode": "0644",
|
|
"takes-config": [
|
|
"scanner",
|
|
"scan-folder",
|
|
"printer",
|
|
"printer-certificate",
|
|
"resolution",
|
|
"color-mode",
|
|
"crop"
|
|
],
|
|
"merge": "json",
|
|
"template": "files/settings.json",
|
|
"trusted": true
|
|
},
|
|
{
|
|
"id": "store",
|
|
"type": "file",
|
|
"path": "${dir:state}/store.json",
|
|
"owner": "brother-device",
|
|
"mode": "0600",
|
|
"template": "files/store.json"
|
|
},
|
|
{
|
|
"id": "device",
|
|
"type": "process",
|
|
"name": "brother-device",
|
|
"artifact": "tools",
|
|
"run": [
|
|
"./brother",
|
|
"device"
|
|
],
|
|
"user": "brother-device",
|
|
"env": {
|
|
"BROTHER_SETTINGS": "${dir:state}/settings.json",
|
|
"BROTHER_ADMIN_PASSWORD": "${dir:state}/admin-password.secret",
|
|
"BROTHER_BROKER": "${dir:state}/broker-device.secret",
|
|
"BROTHER_STORE": "${dir:state}/store.json"
|
|
},
|
|
"restart-on": [
|
|
"settings",
|
|
"store"
|
|
],
|
|
"bus": {
|
|
"queues": [
|
|
"device-asks"
|
|
],
|
|
"state": [
|
|
"device-answers"
|
|
],
|
|
"emits": [
|
|
"scan.added"
|
|
]
|
|
},
|
|
"health": {
|
|
"kind": "unit"
|
|
}
|
|
},
|
|
{
|
|
"id": "watch",
|
|
"type": "process",
|
|
"name": "brother-watch",
|
|
"artifact": "tools",
|
|
"run": [
|
|
"./brother",
|
|
"watch"
|
|
],
|
|
"user": "brother-device",
|
|
"health": {
|
|
"kind": "tool",
|
|
"tool": "brother_health",
|
|
"interval": "60s",
|
|
"timeout": "10s",
|
|
"looks": 2,
|
|
"grace": "60s"
|
|
}
|
|
}
|
|
],
|
|
"build": {
|
|
"artifacts": [
|
|
{
|
|
"name": "tools",
|
|
"kind": "bundle",
|
|
"language": "go",
|
|
"system": "arch",
|
|
"from": "cmd/brother",
|
|
"binary": "brother",
|
|
"loads": [
|
|
"brother"
|
|
],
|
|
"env": {
|
|
"BROTHER_SETTINGS": "${dir:state}/settings.json"
|
|
}
|
|
},
|
|
{
|
|
"name": "files",
|
|
"kind": "archive",
|
|
"from": "files"
|
|
}
|
|
]
|
|
}
|
|
}
|