Skip to content

A simple Golang-based application that queries a PostgreSQL database

License

Notifications You must be signed in to change notification settings

infamousjoeg/kwik-e-mart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A simple Golang-based application that queries a PostgreSQL database

Resources

License

Stars

Watchers

Forks

Packages