Public Repository

Last pushed: 7 days ago
Short Description
Microservice that resolves treatments for a given user key or account for http://split.io
Full Description

CALLHOME NODEJS

Usage with NodeJS

If you want to just run the Node app directly, clone the repository using git clone https://github.com/splitio/callhome.git and follow the README file.

Services

GET
  /get-treatment

QUERY PARAMS
  key:
    This is the key used in the getTreatment call.
  bucketing-key:
    (Optional) This is the bucketing key used in the getTreatment call.
  split-name:
    This should be the name of the split you want to include in the getTreatment call.
  attributes:
    (Optional) This should be a json string of the attributes you want to include in the getTreatment call.

EXAMPLE
  curl 'http://localhost:4444/get-treatment?key=my-customer-key&split-name=my-experiment&attributes=\{"attribute1":"one","attribute2":2,"attribute3":true\}' -H 'Authorization: {SPLITIO_EXT_API_KEY}'

RESPONSE
  {
    "splitName": "my-experiment",
    "treatment": "on"
  }

GET
  /get-treatments

QUERY PARAMS
  keys:
    This is the array of keys to be used in the getTreatments call. Each key should specify a `matchingKey` 
    and a `trafficType`. You can also specify a `bucketingKey`.
  attributes:
    (Optional) This should be a json string of the attributes you want to include in the getTreatments call.

EXAMPLE
  curl 'http://localhost:4444/get-treatments?keys=\[\{"matchingKey":"my-first-key","trafficType":"account"\},\{"matchingKey":"my-second-key","bucketingKey":"my-bucketing-key","trafficType":"user"\}\]&attributes=\{"attribute1":"one","attribute2":2,"attribute3":true\}' -H 'Authorization: {SPLITIO_EXT_API_KEY}'

RESPONSE
  [
    { "splitName": "my-experiment", "treatment":"on" },
    { "splitName": "my-second-experiment", "treatment":"off" },
    ...
    { "splitName": "my-last-experiment", "treatment":"visa" }
  ]

Running the service in Docker container

Command to build & run the docker container :

By default te server uses the port 7548, which is the one exposed by the container.
You can use a different one by setting the SPLITIO_SERVER_PORT environment variable,
but their exposure of that port to the host will depend on your settings.
You can just leave the default port and map it to whatever port you need

Pull the image: docker pull splitsoftware/callhome:1.2

Run the container:

docker run -e SPLITIO_API_KEY={YOUR_API_KEY} -e SPLITIO_DEBUG='off' -e SPLITIO_SERVER_PORT=7549 -p 4444:7549 splitsoftware/callhome:1.2

NOTE: SPLITIO_DEBUG & SPLITIO_SERVER_PORT are optionals

Configs:

SPLITIO_EXT_API_KEY : Callhome will validate every request against Authorization header. This is not a Split API key but an arbitrary value.
SPLITIO_API_KEY : Api-Key for you Split Environment.
SPLITIO_DEBUG : (Optional) Usable for enabling/disabling the logs of the SDK. By default they are off.
SPLITIO_SERVER_PORT : TCP Port of the server inside the container.

Docker Pull Command
Owner
splitsoftware

Comments (0)