Giter Site home page Giter Site logo

entitlements-api-go's Introduction

Entitlements Service

SKU/Bundle changes

  • The /bundles/bundles.example.yml file in this repo is for local testing only
  • To run the app, be sure to copy /bundles/bundles.example.yml to /bundles/bundles.yml
  • To make SKU changes for the live service, see the entitlements-config repository: https://github.com/RedHatInsights/entitlements-config

Application Setup

Install Golang:

sudo dnf install golang # or brew install go on OSX

Clone this repo:

git clone [email protected]:RedHatInsights/entitlements-api-go.git

Then, install the project's Go dependencies by running:

bash ./scripts/dev_deps.sh

Certificates and Configuration

Getting an Enterprise Cert

To run the Entitlements API locally, you will need an Enterprise Services cert with access to the dev subscription endpoint /search/criteria and the export compliance service in whatever environment you are testing in.

  • You can request a personal cert by following ALL steps in this mojo doc.
  • You can request access to export compliance service by following the appropriate steps in this doc.
  • You can export your crt and key like so: openssl pkcs12 -in your-p12-cert.p12 -out your-key.key -nocerts -nodes openssl pkcs12 -in your-p12-cert.p12 -out your-cert-sans-key.crt -clcerts -nokeys

Create your config file

You'll need to make a config file specific to your machine. Create a local config directory: mkdir -p ./local Add a file that contains your local configuration options: $EDITOR ./local/qa.conf.sh The contents should look like this:

export ENT_KEY=./{path_to_key}.key
export ENT_CERT=./{path_to_cert}.crt
export ENT_CA_PATH=./{path_to_ca_cert}.crt
export ENT_SUBS_HOST=https://subscription.dev.api.redhat.com
export ENT_COMPLIANCE_HOST=https://export-compliance.dev.api.redhat.com

Replace {path_to_key} and {path_to_cert} with the locations of the .key and .crt files from the previous section.

Set up your local entitlement bundles

Copy the /bundles/bundles.example.yml to /bundles/bundles.yml in order to have your local app consume bundle data. You can modify this file for local testing. Note: This file is for local testing only. If you wish to make changes to the actual bundles, please refer to https://github.com/RedHatInsights/entitlements-config

Running the Application

Now that everything is set up, you can run the application using:

bash ./scripts/watch.sh ./local/development.env.sh

To run locally with Docker:

docker build -t entitlements-api-go .
docker run -p 3000:3000 entitlements-api-go

Testing Entitlements API with curl

The Entitlements API requires that you pass in a valid x-redhat-identity header or it rejects requests. For an example see cat ./scripts/xrhid_helper.sh

Testing the bundle-sync

To test the bundle sync behavior, you'll need to configure your environment similar to the insructions above, build the script, and run it against the dev environment:

. ./local/development.env.sh
go build -o ./bundle-sync bundle_sync/main.go
./bundle-sync

Running the Unit Tests

  • To run the unit tests, execute the following commands from the terminal: cd controllers go test
  • To include benchmarks: cd controllers go test -bench=.

entitlements-api-go's People

Contributors

abenokraitis avatar astrozzc avatar casey-williams-rh avatar coderbydesign avatar dagbay-rh avatar iphands avatar jhjaggars avatar kruai avatar lpichler avatar petracihalova avatar ryandillinfelton avatar ryelo avatar stevehnh avatar tahmidefaz avatar vbelchio avatar wcmitchell avatar wenottingham avatar xxlhacker 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.