automatisch auf INFLUX schalten, wenn es Chi-ID gibt zuzsätzlich option db=m zum erzwingen von Moing Anzeige Mongo/Influx im Datenstrom
19 lines
492 B
JavaScript
Executable File
19 lines
492 B
JavaScript
Executable File
#!/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')
|