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