fix backend ssl
This commit is contained in:
+24
@@ -256,6 +256,22 @@ server {
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
}
|
||||
}
|
||||
server {
|
||||
listen 3000 ssl;
|
||||
server_name $UI_HOST;
|
||||
client_max_body_size 50M;
|
||||
|
||||
ssl_certificate /etc/nginx/certs/fullchain.pem;
|
||||
ssl_certificate_key /etc/nginx/certs/privkey.pem;
|
||||
|
||||
location / {
|
||||
proxy_pass http://backend:3000/;
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# 2. Docker Compose
|
||||
@@ -349,6 +365,14 @@ server {
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
}
|
||||
}
|
||||
server {
|
||||
listen 3000;
|
||||
server_name localhost;
|
||||
location / {
|
||||
proxy_pass http://backend:3000/;
|
||||
proxy_set_header Host \$host;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# 2. Docker Compose
|
||||
|
||||
@@ -1,15 +1,42 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Injectable, OnModuleInit } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { Domain } from './entities/domain.entity';
|
||||
|
||||
@Injectable()
|
||||
export class DomainsService {
|
||||
export class DomainsService implements OnModuleInit {
|
||||
constructor(
|
||||
@InjectRepository(Domain)
|
||||
private repo: Repository<Domain>,
|
||||
) { }
|
||||
|
||||
async onModuleInit() {
|
||||
await this.seedDefaultDomains();
|
||||
}
|
||||
|
||||
private async seedDefaultDomains() {
|
||||
const count = await this.repo.count();
|
||||
|
||||
if (count === 0) {
|
||||
|
||||
const defaultDomains = [
|
||||
'ya.ru',
|
||||
'vk.com',
|
||||
'ok.ru',
|
||||
'gosuslugi.ru',
|
||||
'ozon.ru',
|
||||
'max.ru',
|
||||
'vkvideo.ru',
|
||||
'rutube.ru',
|
||||
'kinopoisk.ru',
|
||||
'avito.ru'
|
||||
];
|
||||
|
||||
const entities = defaultDomains.map(name => this.repo.create({ name }));
|
||||
await this.repo.save(entities);
|
||||
}
|
||||
}
|
||||
|
||||
async create(createDomainDto: { name: string }) {
|
||||
const exists = await this.repo.findOne({ where: { name: createDomainDto.name } });
|
||||
if (exists) return exists;
|
||||
|
||||
Reference in New Issue
Block a user