telekom / pubsub-horizon-cosmoparrot

A simple HTTP based echo server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cosmoparrot logo

Cosmoparrot

A simple HTTP based echo server.

Building CosmoparrotConfigurationRunning Cosmoparrot

Go Test

Overview

Cosmosparrot simple HTTP based echo server designed to provide a response that mirrors the contents included in the initial request.
It was initially created for Pub/Sub end-to-end test scenarios where it is important to simulate an event message consumer that responds to HTTP (callback) requests.

Building Cosmoparrot

Go build

Assuming you have already installed go, simply run the follwoing to build the executable:

go build

Alternatively, you can also follow the Docker build in the following section if you want to build a Docker image without the need to have Golang installed locally.

Docker build

This repository provides a multi-stage Dockerfile that will also take care about compiling the software, as well as dockerizing Cosmoparrot. Simply run:

docker build -t cosmoparrot:latest  . 

Configuration

Cosmoparrot supports configuration via environment variables and/or a configuration file (config.yml). The configuration file has to be located in the same directory as the executable.

Path Variable Type Default Description
port COSMOPARROT_PORT int 8080 Sets the port to listen on.
responseCode COSMOPARROT_RESPONSECODE int 200 Enforces a specific HTTP response code. Can be used to test different consumer behavior.
methodResponseCodeMapping COSMOPARROT_METHODRESPONSECODEMAPPING string "" Control the HTTP response code per HTTP method, for example: "POST:401"

Running Cosmoparrot

Locally

Simply run the built cosmoparrot executable to start the server:

./cosmoparrot

Alternatively you can run the server in a container:

docker run -p 8080:8080 cosmoparrot

Contributing

We're committed to open source, so we welcome and encourage everyone to join its developer community and contribute, whether it's through code or feedback.
By participating in this project, you agree to abide by its Code of Conduct at all times.

Code of Conduct

This project has adopted the Contributor Covenant in version 2.1 as our code of conduct. Please see the details in our Code of Conduct. All contributors must abide by the code of conduct. By participating in this project, you agree to abide by its Code of Conduct at all times.

Licensing

This project follows the REUSE standard for software licensing. You can find a guide for developers at https://telekom.github.io/reuse-template/.
Each file contains copyright and license information, and license texts can be found in the ./LICENSES folder. For more information visit https://reuse.software/.

About

A simple HTTP based echo server


Languages

Language:Go 89.2%Language:Dockerfile 10.8%