class Result<Type> {
constructor(public data: Type) {}
static ok = <T = unknown>(data: T) => {
return new Result(data);
}
static fail = <T = unknown>(error: T) => {
return new Result(error);
}
}
const requestBoolean = async (arg: boolean): Promise<boolean> => {
return Promise.resolve(arg)
}
const requestNumber = async (arg: number): Promise<number> => {
return Promise.resolve(arg)
}
const mackeRequest = async <A extends unknown[], R>(callback: (...args: A) => Promise<R>, ...args: A) => {
try {
const result = await callback(...args);
return Result.ok<R>(result);
} catch (error) {
throw Result.fail<R>(error as R);
}
}
const makeBoolean = mackeRequest(requestBoolean, true);
const makeNumber = mackeRequest(requestNumber, 10);
Promise<Result<Promise<boolean>>>
вместо Promise<Result<boolean>>
но это уже ближе к истине ./build.sh
и docker-composer up
в linux создается файл applicationMain.txt с правами root. version: "3"
services:
httpd:
image: httpd:2.4
restart: always
expose:
- 8080
networks:
- default
volumes:
- ./docker/conf.d/httpd.conf:/usr/local/apache2/conf/httpd.conf
- ./docker/data/log:/var/log/httpd
- ./:/var/www/html
depends_on:
- php
nginx:
image: nginx:latest
networks:
- nginx-proxy
- default
expose:
- 80
- 443
volumes:
- /etc/nginx/ssl/:/etc/nginx/ssl:ro
- ./docker/data/log:/var/log/nginx:rw
- ./docker/conf.d/nginx.conf:/etc/nginx/nginx.conf:ro
- ./:/var/www/html
depends_on:
- httpd
environment:
- VIRTUAL_HOST=site.ru
php:
build:
context: ./docker/dockerfile
dockerfile: php
expose:
- 9000
networks:
- default
volumes:
- ./:/var/www/html
depends_on:
- db