How to actually run mozilla openbadges

597 views Asked by At

I'm following this tutorial here.

https://github.com/mozilla/openbadges-badgekit/wiki/BadgeKit-Self-Hosting-Guide#badgekit-api-configuration

It says, when you run the API use this command source env_local

The problem is, I'm new to node and not really sure how I run the API. I've downloaded all the stuff, installed node, and got a simple hello world program working with node. I just don't know how I actually run the API. I thought I had to run the procfile, but when I do node procfile I get an error saying cannot find module badegkit\badgekit-api\start

As a hacky ass solution, I figured this out. I tried setting PATH in environment variables to env_local, as well as doing SET path = env_local in the command window and neither worked. However, if you browse to the badgekit api folder then app then lib, there's a db.js file in there.

Here's what I did, their stuff is commented out.

var options = {
  driver: 'mysql',
  // host: process.env.DB_HOST,
  // user: process.env.DB_USER,
  // password: process.env.DB_PASSWORD,
  // database: process.env.DB_NAME,
  host: "127.0.0.1",
  user: "username",
  password: "password",
  database: "dbname",
}

Just put in your mysql creds and then you can run the db migrate. Obviously this isn't ideal as anywhere else that uses env is still going to be screwy, but it got me to step 2.

2014-09-29 Edit For all those curious, as of right now, node isn't really supported on windows per se. I ran into so many issues with python and gyp, that I ended up just spinning up a linux box in hyper v and hosting it there.

1

There are 1 answers

4
clay On

The idea behind that command is to load the environment variables setup in env_local. By deafult, they are set up as a few export commands, which should put the key=value pairs into your running environment.

I actually removed the export strings and stored them as .env_dev, so a file with:

DB_HOST=localhost
DB_NAME=badgekitapi
...etc...

And the command I used to run things was: nf start -e .env_dev

With the API running, and able to store badges, you can now follow the tutorials to run openbadges-badgekit - so you can actually make and issue some badges ; )

Good luck!