kwik-e-mart

command module
v0.0.0-...-57806cc Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: MIT Imports: 8 Imported by: 0

README

Kwik-E-Mart Demo App

image

A simple Golang-based application that queries a PostgreSQL database named kwikemart to read and return customer data stored in the customers table.

Database Structure

$ make create_table
$ make insert_customers

Database Name: kwikemart

Table Name: customers

id first_name last_name pmt_type
1 Homer Simpson cash
2 Montgomery Burns credit
3 Barney Gumble debit
4 Waylon Smithers cash
5 Ned Flanders credit

Required Environment Variables

Provided for Summon in secrets.yml.

variable name expected value
DB_HOST hostname to PostgreSQL database
DB_USERNAME username to use for authentication
DB_PASSWORD password to use for authentication
DB_NAME name of the database to connect to

Run with Summon

Pre-Requisites
Command
summon -p $provider_name go run main.go

OR

make run

Build

Binary From Source
Build for current OS and OS Architecture
go build -o bin/kwikemart .
Build for different OS and OS Architecture
make compile
Build From Dockerfile
make build
Run in Docker
summon -p summon-conjur docker run --name kwik-e-mart -d \
  --restart unless-stopped \
  --env-file @SUMMONENVFILE \
  -p 8080:8080
  nfmsjoeg/kwik-e-mart:latest

OR

make docker_run

Example Output

$ open http://localhost:8080
-------------------------------------------------------
Connected successfully to conjur-demo.xxxxxx.rds.amazonaws.com
Database Username: xxxxxx
Database Password: xxxxxx
-------------------------------------------------------

id             first_name     last_name      pmt_type
-------------------------------------------------------
1              Homer          Simpson        cash
2              Montgomery     Burns          credit
3              Barney         Gumble         debit
4              Waylon         Smithers       cash
5              Ned            Flanders       credit

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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