Go-Bash is a REST API built with Go that allows you to run bash scripts. It provides a simple and efficient way to manage and execute bash scripts through a RESTful interface.
Gorilla Mux: A powerful HTTP router and URL matcher for building Go web servers.
PostgreSQL: Used as the primary database for storing command information.
Docker: Used to containerize the application.
DATA-DOG/go-sqlmock: Used for testing the database layer.
godotenv: Used for loading environment variables from a .env file.
Getting Started
To get a local copy up and running, follow these simple steps.
Prerequisites
Go (latest version)
PostgreSQL
Installation
Clone the repo
git clone https://github.com/Ki4EH/go-bash.git
Install Go packages
go mod download
Create a PostgreSQL database. With the following schema:
CREATE TABLE IF NOT EXISTS "commands" (
"id" SERIAL PRIMARY KEY,
"name" TEXT NOT NULL,
"script" TEXT NOT NULL,
"description" TEXT NOT NULL,
"output" TEXT NOT NULL
);
Or you can use init.sql file in the root directory to create the table.
psql -U your_db_user -d your_db_name -a -f init.sql
Create a .env file in the root directory and add the following environment variables