featws-ruller

command module
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

README

Go Reference License

Featws Ruller About_de

  • The featws-ruller project is an implmentation of the grule-rule-engine, used to evalute rulesheets(.grl)

Required Software

  • You must have the Go Programming Language installed in your machine to run this project. You can get the official download here.

  • Clone the featws-transpiler repository to your local machine and make sure both transpiler and ruller project are in the same folder. You can find the featws-transpiler repository here.

Initializate the project

  • Clone this project to your local machine.
  • On main.go folder (../featws-ruller/main.go), open your local terminal and type the command go run main.go, if your OS is windows, you can by build and run the executable go build && ./featws-ruler.exe, or if your OS is mac, type the command go build -o ruller && ./ruller $@.

Testing diferents rulesheets

  • Check if you have in your workspace the featws-transpiler and copy the path from .grl file for the new case, you can find that on the cases tests -> cases
  • Now just replace the env variable "FEATWS_RULLER_DEFAULT_RULES" on .env file on ruller, with the new path, and run like the instructions above.

Testing rulesheet with resolvers

  • To test if the resolver are loaded, you have to set the featws-resolver-bridge URL, on the .env file to.

Load a rulesheet from remote source

  • To load a rulesheet from a remote soure, just change the .env variable "FEATWS_RULLER_RESOURCE_LOADER_URL" pointed to your URL.

Using main endpoints

By default the port will be :8000

  • GET http://localhost:YOURSETTEDPORT/

    • Will return simple message to client such as: "FeatWS Ruller Works!!!"
  • POST http://localhost:YOURSEETEDPORT/api/v1/eval

    • On this end point you must have to pass a body, witch is the parameters setted by rulesheet folder on the featws-transpiler. Using case 0001 for example the body should be:
         {
            "mynumber": "45"
         }
      
      • Sending the request, response should be something like that: (this response difined by .featws file on ruleshet folder, in that case is false because the condition is mynumber > 12)
          {
            "myboolfeat": false
          }
      
  • GET http://localhost:YOURSEETEDPORT/swagger/index.html

    • On your browser, you can see the swagger documentation of the api.
  • GET http://localhost:YOURSEETEDPORT/health/live?full=1

    • This endpoint will check the live status of the application, just like that:
      {
        "goroutine-threshold": "OK"
      }
      
  • GET http://localhost:YOURSEETEDPORT/health/ready?full=1

    • This endpoint will check the ready status of the services used by ruller project
    {
    "goroutine-threshold": "OK",
    "resolver-bridge": "OK",
    "resource-loader": "OK"
    }
    

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
v1
Package docs GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
Package docs GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
payloads
v1
api

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL