mirror of
https://github.com/usatiuk/writer.git
synced 2025-10-29 00:17:48 +01:00
add https env toggle
This commit is contained in:
@@ -17,7 +17,6 @@ RUN npm run build
|
|||||||
WORKDIR ../
|
WORKDIR ../
|
||||||
|
|
||||||
ENV PORT=8080
|
ENV PORT=8080
|
||||||
ENV DATA_DIR=data
|
|
||||||
|
|
||||||
ENV TYPEORM_CONNECTION=mariadb
|
ENV TYPEORM_CONNECTION=mariadb
|
||||||
#ENV TYPEORM_HOST=localhost
|
#ENV TYPEORM_HOST=localhost
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export const app = new Koa();
|
|||||||
app.use(cors());
|
app.use(cors());
|
||||||
app.use(logger());
|
app.use(logger());
|
||||||
app.use(bodyParser());
|
app.use(bodyParser());
|
||||||
if (config.env === EnvType.production) {
|
if (config.https) {
|
||||||
app.use(sslify({ resolver: xForwardedProtoResolver }));
|
app.use(sslify({ resolver: xForwardedProtoResolver }));
|
||||||
}
|
}
|
||||||
app.use(
|
app.use(
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export interface IConfig {
|
|||||||
env: EnvType;
|
env: EnvType;
|
||||||
port: number;
|
port: number;
|
||||||
jwtSecret: string;
|
jwtSecret: string;
|
||||||
|
https: boolean;
|
||||||
dbConnectionOptions: ConnectionOptions | null;
|
dbConnectionOptions: ConnectionOptions | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@ const production: IConfig = {
|
|||||||
port: parseInt(process.env.PORT, 10) || 3000,
|
port: parseInt(process.env.PORT, 10) || 3000,
|
||||||
jwtSecret: process.env.JWT_SECRET,
|
jwtSecret: process.env.JWT_SECRET,
|
||||||
dbConnectionOptions: null,
|
dbConnectionOptions: null,
|
||||||
|
https: process.env.HTTPS ? process.env.HTTPS === "yes" : false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const development: IConfig = {
|
const development: IConfig = {
|
||||||
|
|||||||
Reference in New Issue
Block a user