Coder Social home page Coder Social logo

clivern / rhino Goto Github PK

View Code? Open in Web Editor NEW
32.0 4.0 1.0 776 KB

❄️ HTTP Mocking & Debugging Service.

License: MIT License

Makefile 5.66% Go 76.11% HTML 17.29% Dockerfile 0.94%
http-mock http-mocking debugging-tool rest-mock clivern rhino developer-tools microservices microservices-architecture hacktoberfest

rhino's Introduction

Rhino Logo

Rhino

HTTP Mocking & Debugging Service

Rhino is an HTTP Mocking & Debugging Service. It enables easy mocking of any HTTP web service for testing and debugging purposes. Also it can simulate high latencies and failures to make sure your services have the capability to withstand and recover from failures. It supports cross-origin resource sharing (CORS) so it can be used as a backend for single page applications.

Documentation

Usage

Get the latest binary.

$ curl -sL https://github.com/Clivern/Rhino/releases/download/x.x.x/Rhino_x.x.x_OS_x86_64.tar.gz | tar xz

Create the config file config.prod.json

{
    "app": {
        "mode": "prod or dev",
        "port": "8080",
        "domain": "http://127.0.0.1:8080",
        "tls": {
            "status": "off",
            "pemPath": "/cert/server.pem",
            "keyPath": "/cert/server.key"
        }
    },
    "mock": [
        {
            "path": "/api/v2/service1/mock/:id",
            "request": {
                "method": "get"
            },
            "response": {
                "statusCode": 200,
                "headers": [
                    {"key": "Content-Type", "value": "application/json"}
                ],
                "body": "{\"id\": \":id\"}"
            },
            "chaos": {
                "latency": "0s",
                "failRate": "0%"
            }
        },
        {
            "path": "/api/v2/service2/mock/:id",
            "request": {
                "method": "get",
                "parameters": {
                    "var_param": ":var_param",
                    "fixed_param": 10
                }
            },
            "response": {
                "statusCode": 200,
                "headers": [
                    {"key": "Content-Type", "value": "application/json"}
                ],
                "body": "@json:@config_dir/route.response.json"
            },
            "chaos": {
                "latency": "0s",
                "failRate": "0%"
            }
        }
    ],
    "debug": [
        {
            "path": "/api/v2/service/debug",
            "chaos": {
                "latency": "0s",
                "failRate": "0%"
            }
        }
    ],
    "log": {
        "level": "info",
        "output": "stdout or /var/log/rhino.log",
        "format": "text or json"
    }
}

Run Rhino with that config file

$ ./rhino serve -c /custom/path/config.prod.json

Check the release.

$ ./rhino version

Test it.

$ curl http://127.0.0.1:8080/_health

You can use fake data flags inside response body and rhino will auto generate them. Here is the full list of supported types:

AnyOf: @fake(:anyof[A||B||C||D])
Latitude: @fake(:lat)
Longitude: @fake(:long)
CreditCardNumber: @fake(:cc_number)
CreditCardType: @fake(:cc_type)
Email: @fake(:email)
DomainName: @fake(:domain_name)
IPV4: @fake(:ipv4)
IPV6: @fake(:ipv6)
Password: @fake(:password)
PhoneNumber: @fake(:phone_number)
MacAddress: @fake(:mac_address)
URL: @fake(:url)
UserName: @fake(:username)
TollFreeNumber: @fake(:toll_free_number)
E164PhoneNumber: @fake(:e_164_phone_number)
TitleMale: @fake(:title_male)
TitleFemale: @fake(:title_female)
FirstName: @fake(:first_name)
FirstNameMale: @fake(:first_name_male)
FirstNameFemale: @fake(:first_name_female)
LastName: @fake(:last_name)
Name: @fake(:name)
UnixTime: @fake(:unix_time)
Date: @fake(:date)
Time: @fake(:time)
MonthName: @fake(:month_name)
Year: @fake(:year)
DayOfWeek: @fake(:day_of_week)
DayOfMonth: @fake(:day_of_month)
Timestamp: @fake(:timestamp)
Century: @fake(:century)
TimeZone: @fake(:timezone)
TimePeriod: @fake(:time_period)
Word: @fake(:word)
Sentence: @fake(:sentence)
Paragraph: @fake(:paragraph)
Currency: @fake(:currency)
Amount: @fake(:amount)
AmountWithCurrency: @fake(:amount_with_currency)
UUIDHypenated: @fake(:uuid_hyphenated)
UUID: @fake(:uuid_digit)

Docker

Clone and then run docker containers.

# Simple setup
$ git clone https://github.com/Clivern/Rhino.git
$ cd Rhino/deployment/basic/docker-compose
$ docker-compose up -d

# In case you want to visualize incoming requests with grafana
$ git clone https://github.com/Clivern/Rhino.git
$ cd Rhino/deployment/advanced/docker-compose
$ docker-compose up -d

Versioning

For transparency into our release cycle and in striving to maintain backward compatibility, Rhino is maintained under the Semantic Versioning guidelines and release process is predictable and business-friendly.

See the Releases section of our GitHub project for changelogs for each release version of Rhino. It contains summaries of the most noteworthy changes made in each release.

Bug tracker

If you have any suggestions, bug reports, or annoyances please report them to our issue tracker at https://github.com/clivern/rhino/issues

Security Issues

If you discover a security vulnerability within Rhino, please send an email to [email protected]

Contributing

We are an open source, community-driven project so please feel free to join us. see the contributing guidelines for more details.

License

© 2020, Clivern. Released under MIT License.

Rhino is authored and maintained by @clivern.

rhino's People

Contributors

clivern avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

ksharpdabu

rhino's Issues

Support URL Parameters

config should look like:

....

    "path": "/api/v2/service2/mock/:id",
    "request": {
        "method": "get",
        "parameters": {
               "x": "y"
         }
    },

....

this method (https://github.com/Clivern/Rhino/blob/master/internal/app/model/route.go#L60) need to support url parameters & the possiblity that we may have many endpoints with the same URI but with different URL parameters.

also allow parameters list to have variables, something like

....

    "path": "/api/v2/service2/mock/items",
    "request": {
        "method": "get",
        "parameters": {
               "id": ":id",
               "type": "something"
         }
    },

....

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

docker-compose
deployment/advanced/docker-compose/docker-compose.yml
  • grafana/loki 2.9.6
  • grafana/promtail 2.9.6
  • prom/prometheus v2.51.0
  • grafana/grafana 10.4.1
deployment/basic/docker-compose/docker-compose.yml
dockerfile
Dockerfile
  • golang 1.21.6
github-actions
.github/workflows/build.yml
  • actions/checkout v3
  • actions/setup-go v5
.github/workflows/release.yml
  • actions/checkout v4
  • actions/setup-go v5
  • goreleaser/goreleaser-action v4
gomod
go.mod
  • go 1.20
  • github.com/bxcodec/faker/v3 v3.8.1
  • github.com/drone/envsubst v1.0.3
  • github.com/gin-gonic/gin v1.9.1
  • github.com/prometheus/client_golang v1.18.0
  • github.com/satori/go.uuid v1.2.0
  • github.com/sirupsen/logrus v1.9.3
  • github.com/spf13/cobra v1.8.0
  • github.com/spf13/viper v1.18.2

  • Check this box to trigger a request for Renovate to run again on this repository

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

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.