API-Auth dazu
automatisch auf INFLUX schalten, wenn es Chi-ID gibt zuzsätzlich option db=m zum erzwingen von Moing Anzeige Mongo/Influx im Datenstrom
This commit is contained in:
18
generate-apikey.js
Executable file
18
generate-apikey.js
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// Script to generate API keys for the SensorAPI
|
||||
|
||||
import crypto from 'crypto'
|
||||
|
||||
const count = parseInt(process.argv[2]) || 1
|
||||
|
||||
console.log(`Generating ${count} API Key(s):\n`)
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
const apiKey = crypto.randomBytes(32).toString('hex')
|
||||
console.log(`${i + 1}. ${apiKey}`)
|
||||
}
|
||||
|
||||
console.log('\nAdd these keys to your .env file:')
|
||||
console.log('API_KEYS=key1,key2,key3')
|
||||
console.log('\nOr set API_AUTH_REQUIRED=true to enable authentication')
|
||||
Reference in New Issue
Block a user