reconfigured env variables and mysql connection

This commit is contained in:
bill bittner 2017-09-12 17:59:55 -07:00
parent 07f22eed3d
commit 59c2bf6c3c
4 changed files with 18 additions and 11 deletions

View file

@ -5,8 +5,7 @@ spee.ch is a single-serving site that reads and publishes images and videos to a
* start mysql
* install mysql
* create a database called `lbry`
* save your connection uri somewhere handy (you will need it when you start the server)
* the uri should be in the form `mysql://user:pass@host:port/dbname`
* save your connection `username` and `password` someplace handy
* start lbrynet daemon
* install the [`lbry`](https://github.com/lbryio/lbry) daemon
* start the `lbry` daemon
@ -17,10 +16,11 @@ spee.ch is a single-serving site that reads and publishes images and videos to a
* run `npm install`
* to start the server, from your command line run `node speech.js` while passing three environmental variables:
* (1) your lbry wallet address (`LBRY_CLAIM_ADDRESS`),
* (2) your mysql connection uri (`MYSQL_CONNECTION_STRING`),
* (2) your mysql username (`MYSQL_USERNAME`),
* (2) your mysql password (`MYSQL_PASSWORD`),
* (3) the environment to run (`NODE_ENV`).
* i.e. `LBRY_CLAIM_ADDRESS=<your wallet address here> MYSQL_CONNECTION_STRING=<your connection uri here> NODE_ENV=development node speech.js`
* e.g. `LBRY_CLAIM_ADDRESS=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX MYSQL_CONNECTION_STRING=mysql://root:XXXXXX@localhost:3306/lbry NODE_ENV=development node speech.js`
* i.e. `LBRY_CLAIM_ADDRESS=<your wallet address here> MYSQL_USERNAME=<username here> MYSQL_PASSWORD=<password here> NODE_ENV=development node speech.js`
* e.g. `LBRY_CLAIM_ADDRESS=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX MYSQL_USERNAME="lbry" MYSQL_PASSWORD="xxxxxx" NODE_ENV=development node speech.js`
* To run hot, use `nodemon` instead of `node`
* visit [localhost:3000](http://localhost:3000)

View file

@ -3,6 +3,7 @@
"LbryClaimAddress": "LBRY_CLAIM_ADDRESS"
},
"Database": {
"MySqlConnectionUri": "MYSQL_CONNECTION_STRING"
"username": "MYSQL_USERNAME",
"password": "MYSQL_PASSWORD"
}
}

View file

@ -6,7 +6,9 @@
"GoogleId": "none"
},
"Database": {
"MySqlConnectionUri": "none"
"database": "lbry",
"username": "none",
"password": "none"
},
"Logging": {
"LogLevel": "none"

View file

@ -6,14 +6,18 @@ const config = require('config');
const db = {};
const logger = require('winston');
const connectionUri = config.get('Database.MySqlConnectionUri');
const sequelize = new Sequelize(connectionUri, {
const database = config.get('Database.database');
const username = config.get('Database.username');
const password = config.get('Database.password');
const sequelize = new Sequelize(database, username, password, {
host : 'localhost',
dialect: 'mysql',
logging: false,
pool : {
max : 5,
min : 0,
idle : 20000,
acquire: 20000,
idle : 10000,
acquire: 10000,
},
});