1 Commits

Author SHA1 Message Date
0648dcb96c Added .env file support more directly 2024-03-23 00:14:31 -05:00
5 changed files with 41 additions and 2 deletions

6
.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
.env
**/node_modules/
package-lock.json
*.swp
.prettyrc
.vscode

1
api/.gitignore vendored
View File

@@ -1 +0,0 @@
.env

View File

@@ -17,4 +17,17 @@ app.use("/api/data", dataRoutes);
app.use("/api/inventory", inventoryRoutes); app.use("/api/inventory", inventoryRoutes);
const PORT = process.env.PORT || 3000; const PORT = process.env.PORT || 3000;
app.listen(PORT, () => console.log(`Server running on port ${PORT}`)); app.listen(PORT, () => {
console.log(`Environment: \n\n
${JSON.stringify(process.env)}`);
console.log(`Server running on port ${PORT}`); //These will both get updated to smartLogging later
console.log(`System Settings: \n
port = ${process.env.PORT} \n
debug = ${process.env.DEBUG} \n
dotenv_key = ${process.env.DOTENV_KEY} \n
ebay_client_id = ${process.env.EBAY_CLIENT_ID} \n
ebay_client_secret = ${process.env.EBAY_CLIENT_SECRET} \n
ebay_dev_id = ${process.env.EBAY_DEV_ID} \n
ebay_redirect_uri = ${process.env.EBAY_REDIRECT_URI} \n
`);
});

View File

@@ -4,5 +4,15 @@ services:
build: ./api build: ./api
ports: ports:
- "3000:3000" - "3000:3000"
env_file:
- .env
# environment:
# PORT: 8005
# DEBUG: "false"
# DOTENV_KEY: "DotKeyDC"
# EBAY_CLIENT_ID: "EbayClientIDDC"
# EBAY_CLIENT_SECRET: "EbayClientSecretDC"
# EBAY_DEV_ID: "EbayDevIDDC"
# EBAY_REDIRECT_URI: "EbayRedirectURIDC"
volumes: volumes:
- ./api:/usr/src/app # Mount the local ./api directory to /usr/src/app in the container - ./api:/usr/src/app # Mount the local ./api directory to /usr/src/app in the container

11
envSample Normal file
View File

@@ -0,0 +1,11 @@
PORT=8003
DEBUG=true
DOTENV_KEY=DotKey
EBAY_CLIENT_ID=EbayClientID
EBAY_CLIENT_SECRET=EbayClientSecret
EBAY_DEV_ID=EbayDevID
EBAY_REDIRECT_URI=EbayRedirectURI
#I'm not 100% on this, but I think the --env-file flag for docker containers should handle this. We just
#need to figure out how that gets consumed.