diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..93f1361 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +node_modules +npm-debug.log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..760d5b7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM node:20 +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . +CMD ["node", "app.js"] \ No newline at end of file diff --git a/app.js b/app.js index 0814f46..edc620c 100644 --- a/app.js +++ b/app.js @@ -10,7 +10,7 @@ const spotifyRequestsLimit = 50; const thresholdLove = 0.6; const clientId = process.env.CLIENT_ID; const clientSecret = process.env.CLIENT_SECRET; -const databaseUrl = process.env.DATABASE_URL; +const dbApiUrl = process.env.DBAPI_URL; //#endregion //#region STRUCTURE @@ -174,7 +174,7 @@ async function mainAlgorithm(accessToken) { async function main() { try { - const response = await axios.get(`${databaseUrl}/users`); + const response = await axios.get(`${dbApiUrl}/users`); const users = response.data; for (const user of users) { @@ -200,7 +200,7 @@ async function main() { const newRefreshToken = response.data.refresh_token; try { - const res = await axios.put(`${databaseUrl}/users/${spotifyId}/tokens`, { + const res = await axios.put(`${dbApiUrl}/users/${spotifyId}/tokens`, { accessToken: newAccessToken, refreshToken: newRefreshToken !== undefined ? newRefreshToken : refreshToken })