diff --git a/config/production.env b/config/production.env index 798f138..708f9f0 100644 --- a/config/production.env +++ b/config/production.env @@ -2,7 +2,7 @@ DATABASE_USER=root DATABASE_PASSWORD=honey_badger DATABASE=honey_badger IS_PRODUCTION=true -HOST=www.hijavascript.com +HOST=blog.chtoma.com PORT=3000 IS_TEST=false SENGGRID_API_KEY=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 \ No newline at end of file diff --git a/config/production.json b/config/production.json index 35cb411..e033b6b 100644 --- a/config/production.json +++ b/config/production.json @@ -3,7 +3,7 @@ "DATABASE_PASSWORD": "honey_badger", "DATABASE": "honey_badger", "IS_PRODUCTION": true, - "HOST": "www.hijavascript.com", + "HOST": "blog.chtoma.com", "PORT": 3000, "IS_TEST": false } diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 0000000..110e450 --- /dev/null +++ b/ecosystem.config.js @@ -0,0 +1,31 @@ +module.exports = { + apps: [ + { + name: 'honey-badger', + script: './dist/main.js', + watch: true, + env: { + COMMON_VARIABLE: 'true', + }, + env_production: { + NODE_ENV: 'production', + }, + }, + ], + + deploy: { + production: { + user: 'root', + host: ['chtoma.com'], + port: '22', + ref: 'origin/master', + repo: 'git@github.com:sxlwar/honey-badger.git', + path: '/blog', + ssh_options: 'StrictHostKeyChecking=no', + env: { + NODE_ENV: 'production', + }, + 'post-deploy': 'npm install && pm2 reload ecosystem.config.js --env production', + }, + }, +}; diff --git a/ecosystem.json b/ecosystem.json deleted file mode 100644 index e9e106b..0000000 --- a/ecosystem.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "apps": [ - { - "name": "honey-badger", - "script": "main.js", - "env": { - "COMMON_VARIABLE": "true" - }, - "env_production": { - "NODE_ENV": "production" - } - } - ], - "deploy": { - "production": { - "user": "yang", - "host": ["hijavascript.com"], - "port": "22", - "ref": "public/master", - "repo": "git@github.com:sxlwar/honey-badger.git", - "path": "/www", - "ssh_options": "StrictHostKeyChecking=no", - "post-deploy": "pm2 reload ecosystem.json --env production && npm run prestart:prod", - "env": { - "NODE_ENV": "production" - } - } - } -} diff --git a/src/main.ts b/src/main.ts index 4b09a00..cf1a412 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,8 +1,6 @@ import { NestFactory } from '@nestjs/core'; import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; - import * as helmet from 'helmet'; - import { AppModule } from './app.module'; import { Env } from './shared/constant/constant'; @@ -10,7 +8,7 @@ declare const module: any; async function bootstrap() { const isDev = process.env.NODE_ENV === Env.development; - const app = await NestFactory.create(AppModule, { cors: isDev || ['hijavascript.com'] }); + const app = await NestFactory.create(AppModule, { cors: isDev || ['chtoma.com'] }); const hostDomain = AppModule.notProd ? `${AppModule.host}:${AppModule.port.toString()}` : AppModule.host; // Help secure app by setting various HTTP headers; diff --git a/src/shared/config/config.enum.ts b/src/shared/config/config.enum.ts index ec56d60..9403960 100644 --- a/src/shared/config/config.enum.ts +++ b/src/shared/config/config.enum.ts @@ -17,7 +17,7 @@ export enum RepositoryToken { export enum GithubAuth { clientId = '54a9e9e065ccb8f11871', clientSecret = 'a1b780ca64f823fda42ea01d3e037672a61039fd', - redirect = 'https://www.hijavascript.com', + redirect = 'https://blog.chtoma.com', } export enum GithubAuthTest { @@ -32,6 +32,9 @@ export enum GithubAuthDev { redirect = 'http://localhost:4200', } +/** + * Update token below if domain changed; + */ export enum QiniuToken { accessKey = 'Y7KtC0UrXL6JB1MaH1Z3VaVLgK-7XJEHkhWCC4xx', secretKey = '80nRC4OM7yANxQhp8iC722C7ybCyTuluzMXKxUnb', diff --git a/src/subscription/service/subscription.service.ts b/src/subscription/service/subscription.service.ts index 0917a97..a78be8e 100644 --- a/src/subscription/service/subscription.service.ts +++ b/src/subscription/service/subscription.service.ts @@ -1,17 +1,17 @@ import { Inject, Injectable } from '@nestjs/common'; import { send, setApiKey } from '@sendgrid/mail'; - import * as moment from 'moment'; import { from, Observable } from 'rxjs'; import { map, switchMap } from 'rxjs/operators'; import { Repository } from 'typeorm'; - import { Category } from '../../article/interface/article.interface'; import { ArticleService } from '../../article/service/article.service'; import { RepositoryToken } from '../../shared/config/config.enum'; import { ConfigService } from '../../shared/config/config.service'; import { SubscriptionEntity } from '../entity/subscription.entity'; + + interface DynamicContent { href: string; title: string; @@ -23,7 +23,7 @@ interface DynamicContent { export class SubscribeService { private readonly templateId = 'd-4c2338f502da47c2a18712a2c67851f1'; - private prodAddress = 'https://www.hijavascript.com'; + private prodAddress = 'https://blog.chtoma.com'; private clientAddress = 'http://localhost:4200'; private serverAddress = 'http://localhost:3000';