Weired knex env fix

This commit is contained in:
Nicolai Ort 2021-08-14 13:23:11 +02:00
parent b14fa05adc
commit fef7daaf96
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F
2 changed files with 5 additions and 9 deletions

View File

@ -4,7 +4,7 @@ COPY package.json .
COPY yarn.lock . COPY yarn.lock .
RUN yarn --production --frozen-lockfile RUN yarn --production --frozen-lockfile
COPY migrations ./migrations COPY migrations ./migrations
COPY src/server.js ./ COPY src ./src
COPY knexfile.js ./ COPY knexfile.js ./
RUN mkdir db RUN mkdir db
# #
@ -14,4 +14,4 @@ WORKDIR /app
COPY --from=0 /app /app COPY --from=0 /app /app
ENV NODE_ENV production ENV NODE_ENV production
EXPOSE 3000 EXPOSE 3000
ENTRYPOINT ["/bin/sh", "-c", "yarn migrate && node ./server.js"] ENTRYPOINT ["/bin/sh", "-c", "yarn migrate && node ./src/server.js"]

View File

@ -15,13 +15,9 @@ let config = {
return `http://${config.domain}`; return `http://${config.domain}`;
} }
} }
const environment = process.env.NODE_ENV || 'development';
const knex = require('knex')({ const knexConfiguration = require('../knexfile')[environment];
client: 'sqlite3', const knex = require('knex')(knexConfiguration);
connection: {
filename: "./dev.sqlite3"
}
});
const authenticate = { realm: 'Short' } const authenticate = { realm: 'Short' }
fastify.register(require('fastify-basic-auth'), { validate, authenticate }); fastify.register(require('fastify-basic-auth'), { validate, authenticate });