running api
This commit is contained in:
parent
a7072e6130
commit
bac7b6f275
6 changed files with 27 additions and 4 deletions
|
@ -5,6 +5,7 @@
|
|||
repo: https://git.jon-e.net/jonny/chatbridge
|
||||
dest: "{{ chatbridge_user_home }}/chatbridge"
|
||||
version: "HEAD"
|
||||
# failed_when: "command_result.failed and 'Local modifications' not in command_result.msg"
|
||||
register: command_result
|
||||
failed_when: "command_result.failed and 'Local modifications' not in command_result.msg"
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
template:
|
||||
src: chatbridge_env.j2
|
||||
dest: "{{ chatbridge_user_home}}/.env"
|
||||
mode: "600"
|
||||
|
||||
- name: create https nginx config
|
||||
become: yes
|
||||
|
@ -20,6 +21,7 @@
|
|||
template:
|
||||
src: nginx_chatbridge_http.conf.j2
|
||||
dest: /etc/nginx/sites-available/chatbridge.conf
|
||||
|
||||
when:
|
||||
- chatbridge_https is defined
|
||||
- not chatbridge_https
|
||||
|
|
|
@ -14,11 +14,20 @@
|
|||
system: true
|
||||
|
||||
|
||||
|
||||
- name: Create public directory and give permissions to www-data
|
||||
become: yes
|
||||
file:
|
||||
mode: '660'
|
||||
mode: '755'
|
||||
state: directory
|
||||
group: "www-data"
|
||||
owner: "{{ chatbridge_user }}"
|
||||
path: "{{ chatbridge_user_home }}/public"
|
||||
|
||||
- name: Chmod home directory
|
||||
become: yes
|
||||
file:
|
||||
mode: '755'
|
||||
state: directory
|
||||
group: "www-data"
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ server {
|
|||
}
|
||||
|
||||
location {{ chatbridge_webroot }}/ {
|
||||
rewrite ^{{ chatbridge_webroot }}/?(.*)$ $1 break;
|
||||
rewrite ^{{ chatbridge_webroot }}?(/.*)$ $1 break;
|
||||
root {{ chatbridge_user_home }}/public;
|
||||
try_files $uri $uri/ $uri/index.html =404;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import express, { NextFunction, Request, Response } from 'express';
|
|||
import config from 'config';
|
||||
import cors from 'cors';
|
||||
import { AppDataSource } from './db/data-source';
|
||||
|
||||
import AppError from './errors/appError';
|
||||
|
||||
|
||||
|
||||
|
|
11
server/errors/appError.ts
Normal file
11
server/errors/appError.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
export default class AppError extends Error {
|
||||
status: string;
|
||||
isOperational: boolean;
|
||||
constructor(public statusCode: number = 500, public message: string) {
|
||||
super(message);
|
||||
this.status = `${statusCode}`.startsWith('4') ? 'fail' : 'error';
|
||||
this.isOperational = true;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue