diff --git a/.dockerignore b/.dockerignore index 4a7f73a..7f89ad8 100644 --- a/.dockerignore +++ b/.dockerignore @@ -16,9 +16,4 @@ logs # Misc .DS_Store .fleet -.idea - -# Local env files -.env -.env.* -!.env.example +.idea \ No newline at end of file diff --git a/README.md b/README.md index d5d4fb0..3333534 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,14 @@ a Page to view some global statistics about [Modrinth](https://modrinth.com/) * data on specific projects - Same graphs as for mods but only showing a single project * settings * only show specif versions + +### .env + +```dotenv +# example .env +MONGODB_PORT=27017 +MONGODB_ADMIN_USER=admin +MONGODB_ADMIN_PASSWORD=admin +MONGODB_USER=user +MONGODB_PASSWORD=password +``` \ No newline at end of file diff --git a/compose.yml b/compose.yml index 5d1760b..4780969 100644 --- a/compose.yml +++ b/compose.yml @@ -1,9 +1,10 @@ -version: "3" services: my-app: build: . ports: - "3000:3000" + env_file: + - ./.env environment: - WAIT_HOSTS=mongodb:27017 - WAIT_HOSTS_TIMEOUT=300 @@ -12,10 +13,12 @@ services: mongodb: image: mongo ports: - - '27017' + - ${MONGODB_PORT}:27017 + env_file: + - ./.env environment: - - MONGO_INITDB_ROOT_USERNAME=server - - MONGO_INITDB_ROOT_PASSWORD=noPass4tooDay + - MONGO_INITDB_ROOT_USERNAME=${MONGODB_ADMIN_USER} + - MONGO_INITDB_ROOT_PASSWORD=${MONGODB_ADMIN_PASSWORD} - MONGO_INITDB_DATABASE=stats volumes: - /data/db diff --git a/mongo-init.js b/mongo-init.js index 1b0f5a7..3797a93 100644 --- a/mongo-init.js +++ b/mongo-init.js @@ -1,7 +1,5 @@ -db.createUser( - { - user: "server", - pwd: "noPass4tooDay!", - roles: [ { role: "readWrite", db: "stats" }] - } -) \ No newline at end of file +db.createUser({ + user: process.env.MONGODB_USER, + pwd: process.env.MONGODB_PASSWORD, + roles: [{ role: "readWrite", db: "stats" }], +}); diff --git a/nuxt.config.ts b/nuxt.config.ts index 13af955..448aff9 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -15,16 +15,6 @@ export default defineNuxtConfig({ "/downloads": { redirect: "/downloads/major", }, - // see - https://github.com/unjs/nitro/issues/889 - // "/downloads/all": { - // prerender: true - // }, - // "/downloads/minor": { - // prerender: true - // }, - // "/downloads/major": { - // prerender: true - // } }, nitro: { @@ -32,8 +22,7 @@ export default defineNuxtConfig({ storage: { statistics: { driver: "mongodb", - connectionString: - "mongodb://server:noPass4tooDay!@mongodb:27017/stats", + connectionString: `mongodb://${process.env.MONGODB_USER}:${process.env.MONGODB_PASSWORD}@mongodb:27017/stats`, databaseName: "stats", collectionName: "stats", },