diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..7d5b20b --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +NODE_ENV=development +PORT=8080 +MUSIC_PATH= diff --git a/package.json b/package.json index bc7dd80..f930fc6 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "babel-loader": "^8.0.4", "chai": "^4.2.0", "css-loader": "^2.1.0", + "dotenv-webpack": "^1.7.0", "electron": "^5.0.1", "file-loader": "^3.0.1", "mocha": "^6.0.0", diff --git a/src/App.js b/src/App.js index c9360aa..9d68f7f 100644 --- a/src/App.js +++ b/src/App.js @@ -16,10 +16,7 @@ import Archive from "./melodii/SongArchive"; var archive = new Archive(); var mp = new MusicPlayer(); -// const playlist = new Playlist("Test", "\\\\PAODA-SERVER\\Weeb_Home\\Music") -// archive.add(null, playlist); - -const filepath = new Filepath("/home/paoda/Downloads/Music"); +const filepath = new Filepath(process.env.MUSIC_PATH); (async () => { let list = await filepath.getValidFiles(); diff --git a/src/components/Body.js b/src/components/Body.js index ad2c1b7..c19a8d1 100644 --- a/src/components/Body.js +++ b/src/components/Body.js @@ -71,7 +71,7 @@ export default class Body extends React.Component { }; if (!Settings.has("tableJSON")) { - let tableJSON = await generate("/home/paoda/Downloads/Music", template); + let tableJSON = await generate(process.env.MUSIC_PATH, template); console.log("Initialize: ", tableJSON) this.setState({ table: tableJSON }); diff --git a/src/components/Modal/SettingsManager.js b/src/components/Modal/SettingsManager.js index affbb07..d37e1b9 100644 --- a/src/components/Modal/SettingsManager.js +++ b/src/components/Modal/SettingsManager.js @@ -61,7 +61,7 @@ export default class SettingsManager extends Modal { if (Settings.has("tableJSON")) Settings.set("tableJSON", template); else console.info("There was no Table Saved to Delete!") - const tableJSON = await generate("/home/paoda/Downloads/Music", template); + const tableJSON = await generate(process.env.MUSIC_PATH, template); Emitter.emit("newTable", tableJSON); diff --git a/webpack.config.js b/webpack.config.js index 7e47718..306ea03 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,4 +1,7 @@ require('dotenv').config(); +const Dotenv = require('dotenv-webpack'); + + const path = require('path'); const webpack = require('webpack'); @@ -37,5 +40,8 @@ module.exports = { contentBase: path.join(__dirname, 'build'), compress: true, port: process.env.PORT - } + }, + plugins: [ + new Dotenv() + ] }; \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 355c950..ff62ce3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2062,6 +2062,25 @@ domain-browser@^1.1.1: resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA== +dotenv-defaults@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/dotenv-defaults/-/dotenv-defaults-1.0.2.tgz#441cf5f067653fca4bbdce9dd3b803f6f84c585d" + integrity sha512-iXFvHtXl/hZPiFj++1hBg4lbKwGM+t/GlvELDnRtOFdjXyWP7mubkVr+eZGWG62kdsbulXAef6v/j6kiWc/xGA== + dependencies: + dotenv "^6.2.0" + +dotenv-webpack@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/dotenv-webpack/-/dotenv-webpack-1.7.0.tgz#4384d8c57ee6f405c296278c14a9f9167856d3a1" + integrity sha512-wwNtOBW/6gLQSkb8p43y0Wts970A3xtNiG/mpwj9MLUhtPCQG6i+/DSXXoNN7fbPCU/vQ7JjwGmgOeGZSSZnsw== + dependencies: + dotenv-defaults "^1.0.2" + +dotenv@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064" + integrity sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w== + dotenv@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.0.0.tgz#ed310c165b4e8a97bb745b0a9d99c31bda566440"