Теперь у ssl отдельная колонка в конфиге

This commit is contained in:
Данил 2024-08-12 22:21:08 +03:00
parent 403c471db0
commit d6491337c0
2 changed files with 7 additions and 6 deletions

View file

@ -9,9 +9,10 @@ database: # Postgresql database data, for connection
port: 5432
server:
host: 'localhost'
private_key: '/CertSSL/private.key' # The path to the private SSL key file (String)
cert: '/CertSSL/fullchain.pem' # The path to the SSL certificate (String)
ssl: true # Enable or disable SSL support [Boolean]
ssl:
private_key: '/CertSSL/private.key' # The path to the private SSL key file (String)
cert: '/CertSSL/fullchain.pem' # The path to the SSL certificate (String)
work: true # Enable or disable SSL support [Boolean]
log:
print: true # Enable or disable logging [Boolean]
level: 'info' # Log level (Fatal/Error/Warn/Log/Debug) [String]

View file

@ -4,10 +4,10 @@ const fs = require('fs');
const fastify = require('fastify')({
logger: config['server']['log']['print'] ? logger : false,
...config['server']['ssl'] ? {
...config['server']['ssl']['work'] ? {
https: {
key: fs.readFileSync(config['server']['private_key'], 'utf8'),
cert: fs.readFileSync(config['server']['cert'], 'utf8'),
key: fs.readFileSync(config['server']['ssl']['private_key'], 'utf8'),
cert: fs.readFileSync(config['server']['ssl']['cert'], 'utf8'),
}
} : false
});