Coder Social home page Coder Social logo

benjaminstokes / first-discovery-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pga03/first-discovery-server

0.0 2.0 0.0 106 KB

A server side implementation to serve a First Discovery Editor instance and provide a means for storing preferences to the GPII Preferences server.

License: Other

JavaScript 100.00%

first-discovery-server's Introduction

first-discovery-server

A server side implementation to serve a First Discovery Editor instance and provide a means for storing preferences to the GPII Preferences server.

Usage

By default the server will run from port 8088, see Configuration to use a different port. The First Discovery Tool will be reachable off of the /demos path e.g. http://localhost:8088/demos/prefsServerIntegration

Configuration

The First Discovery Server can be configured via Kettle Configs. A set of these are provided with the server in the config directory.

The gpii.firstDiscovery.server.configurator grade defines a default schema for which the configuration is validated against. If the validation fails, the application will throw and error.

Launching

The First Discovery Server can be launched as a Kettle application by making use of Kettle Configs.

There are two typical ways of launching a Kettle app, programmatically and from command line

(See: Starting a Kettle application)

Programmatically

// require the kettle module
var kettle = require("kettle");

// load the config
kettle.config.loadConfig({
    // path to the config directory
    configPath:"./src/config",

    // name of the config to load, without the file extension
    configName: "vagrant"
});

Command Line

# Call Kettle's init.js script with the
# configPath and configName
node node_modules/kettle/init.js <configPath> [<configName>]

# or using an environment variable to specify
# the configName
NODE_ENV=<configName> node node_modules/kettle/init.js <configPath>

Resources

URL Request Description
/user?[view=:view] POST Accepts a set of preferences, in a JSON object, to be stored on the preferences server. A GPII token will be returned and can be used for retrieving the preferences on a GPII enabled device. The view query parameter is used to specify which ontology the preferences are stored in. (See: Preferences Server)

Development

Vagrant and Ansible configuration has been provided to make the setup of a development environment much simpler. During development you'll be able to work on your local machine and run a virtual machine to host the actual server.

Dependencies

Working with the VM

Once you've cloned the repository onto your local system you'll only need to run vagrant up to create the vm. By default, the server will be accessible on your host machine at http://localhost:8088. (e.g. http://localhost:8088/demos/prefsServerIntegration).

NOTE: If you changed the port option, nodejs_app_tcp_port, in the vars.yml file or 8088 is already in use on your host machine, the actual URL may be different.

Logs output by the VM can be viewed in a web browser at http://127.0.0.1:19531/entries?_EXE=/usr/bin/node&follow.

Secrets

the client_id and client_secret are confidential and should not be committed. Vagrant is setup to be provisioned with environment variables from a "secrets.yml" file stored in the "provisioning" directory. "secrets.yml" is ignored by git and should not be added to versioning. An example is provided at "secrets.yml.example" and takes the form:

secrets_env_vars:
  - GPII_OAUTH2_AUTH_CLIENT_ID=first_discovery_client_id
  - GPII_OAUTH2_AUTH_CLIENT_SECRET=first_discovery_client_secret

first-discovery-server's People

Contributors

jobara avatar avtar avatar amb26 avatar cindyli avatar duhrer avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.