Skip to content
This repository has been archived by the owner on Jun 21, 2019. It is now read-only.

Commit

Permalink
renaming files
Browse files Browse the repository at this point in the history
  • Loading branch information
narendasan committed Oct 8, 2016
1 parent 4e009c0 commit 90629b9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ node_modules
.DS_Store
temp

ENV_CONFIG
DEV_ENV_CONFIG
PROD_ENV_CONFIG
dev.config
prod.config
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The following environment variables can be used to configure the API for your sy
| HACKILLINOIS_SUPERUSER_EMAIL | Any valid email | Overrides the default superuser email ('[email protected]') |
| HACKILLINOIS_SUPERUSER_PASSWORD | Any string | Overrides the default superuser password ('ABCD1234!') |
| HACKILLINOIS_MAIL_KEY | Any string | Sets the mail service API key |
| DB_NAME | Any vaild SQL DB name | Overrides default MySQL DB name (hackillinois-2017) |
| DB_NAME | Any vaild SQL DB name | Overrides default MySQL DB name (hackillinois-2017) |
| DB_USERNAME | Any string | Overrides default MySQL username ('root') |
| DB_PASSWORD | Any string | Overrides default MySQL password ('') |
| DB_HOSTNAME | Any valid URI | Overrides default MySQL host ('127.0.0.1') |
Expand All @@ -71,7 +71,7 @@ Note that this API is targeted for hosting via AWS, so any AWS-specific settings
(e.g. those in IAM roles) are used by this API before settings in any environment
variables or other credentials files.

There are a provided files ```DEV_ENV_CONFIG.template``` and ```PROD_ENV_CONFIG.template``` in the config directory to show how to hold environment variables for use in this application. A by creating ```DEV_ENV_CONFIG``` file in the config directory you can set the environment variables to be loaded for development when you run ```npm run dev```. Similarly a ```PROD_ENV_CONFIG``` file in the config directory will configure for the application for production (e.g AWS) when you run ```npm run prod```.
There are a provided files ```dev.config.template``` and ```prod.config.template``` in the config directory to show how to hold environment variables for use in this application. A by creating ```dev.config``` file in the config directory you can set the environment variables to be loaded for development when you run ```npm run dev```. Similarly a ```prod.config``` file in the config directory will configure for the application for production (e.g AWS) when you run ```npm run prod```.
## Installation

#### Dependencies
Expand Down Expand Up @@ -110,11 +110,11 @@ node api.js
If you are using ```ENV_CONFIG``` files then run:


For the developer configurations (```DEV_ENV_CONFIG```)
For the developer configurations (```dev.config```)
```
npm run dev
```
For the production configurations (```PROD_ENV_CONFIG```)
For the production configurations (```prod.config```)
```
npm run prod
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###############################################################################
# PROD_ENV_CONFIG
# DEV_ENV_CONFIG
###############################################################################
#ENV AND PORTS
NODE_ENV=development
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"winston": "^2.2.0"
},
"scripts": {
"dev" : "./resources/scripts/startup.sh DEV",
"prod" : "./resources/scripts/startup.sh PROD"
"dev" : "./resources/scripts/startup.sh dev",
"prod" : "./resources/scripts/startup.sh prod"
}
}
10 changes: 7 additions & 3 deletions resources/scripts/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
RED='\033[0;31m'
YELLOW='\033[0;33m'
NC='\033[0m'
if [ -f config/$1_ENV_CONFIG ]; then
if [ -f config/$1.config ]; then
while read line; do
[[ "$line" =~ ^#.*$ ]] && continue
[ -z "$line" ] && continue
export "$line";
done < config/$1_ENV_CONFIG
done < config/$1.config
else
echo -e "${RED}Missing a ${1} configuration file\nPlease add a file called ${1}_ENV_CONFIG in the config directory\n${YELLOW}Take a look at config/${1}_ENV_CONFIG.template for an example on how the structure the file${NC}"
if [[ $1 == *"dev"* ]]; then
echo -e "${RED}Missing a development configuration file\nPlease add a file called ${1}.config in the config directory\n${YELLOW}Take a look at config/${1}.config.template for an example on how the structure the file${NC}"
elif [[ $1 == *"prod"* ]]; then
echo -e "${RED}Missing a production configuration file\nPlease add a file called ${1}.config in the config directory\n${YELLOW}Take a look at config/${1}.config.template for an example on how the structure the file${NC}"
fi
exit 1
fi
node api.js

0 comments on commit 90629b9

Please sign in to comment.