remove unnecessary PRINTSERVANT_SECRET option

main
radex 2024-02-02 12:19:05 +01:00
parent 8b1857bc3b
commit 2f64dae624
Signed by: radex
SSH Key Fingerprint: SHA256:hvqRXAGG1h89yqnS+cyFTLKQbzjWD4uXIqw7Y+0ws30
2 changed files with 2 additions and 9 deletions

View File

@ -18,12 +18,11 @@ PRINTSERVANT_CONFIG - JSON config, like so:
{
name: 'DYMO_LabelWriter450',
aliases: ['dymo', 'label'],
ipp_url: 'ipp://$SECRET@printmaster.waw.hackerspace.pl/printers/DYMO_LabelWriter450',
ipp_url: 'ipp://printmaster.waw.hackerspace.pl/printers/DYMO_LabelWriter450',
},
...
]
}
PRINTSERVANT_SECRET - Optional, used to substitute $SECRET in printer configs' ipp_urls
```

View File

@ -8,7 +8,6 @@ const bodyParser = require('body-parser')
const PORT = Number(process.env.PRINTSERVANT_PORT) || 3199
const CONFIG = JSON.parse(process.env.PRINTSERVANT_CONFIG || 'null')
const SECRET = process.env.PRINTSERVANT_SECRET || ''
const MAX_SIZE_MB = Number(process.env.PRINTSERVANT_MAX_SIZE_MB) || 10
if (!(PORT && CONFIG)) {
@ -24,12 +23,7 @@ for (const printerConfig of CONFIG.printers) {
throw new Error("Printer config must have a name and url")
}
if (ipp_url.includes('$SECRET') && !SECRET) {
throw new Error(`Printer '${name}' config has a secret in the url but no PRINTSERVANT_CONFIG was provided`)
}
const url = ipp_url.replace('$SECRET', SECRET)
const ippPrinter = ipp.Printer(url)
const ippPrinter = ipp.Printer(ipp_url)
printers.push({ name, aliases, ippPrinter })
}