Qwik-E-Mart Demo App
A simple Golang-based application that queries a PostgreSQL database named qwikemart
to read and return customer data stored in the customers
table.
- Database Structure
- Required Environment Variables
- Run with Summon
- Build Binary From Source
- Example Output
- License
Database Structure
Database Name: qwikemart
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
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
summon -p $provider_name -e $env_name go run main.go
Build Binary From Source
Build for current OS and OS Architecture
go build .
Build for different OS and OS Architecture
GOOS=windows GOARCH=amd64 go build .
GOOS
is the operating system nameGOARCH
is the architecture to compile for
Example Output
$ summon -p summon-conjur -e demo -f secrets.yml go run main.go
-----------------------------------
Connected successfully to conjur-demo.xxxxxxxxx.rds.amazonaws.com
Database Username: apu
Database Password: xxxxxxxx
-----------------------------------
id, first_name, last_name, pmt_type
-----------------------------------
1, Homer, Simpsons, cash
2, Montgomery, Burns, credit
3, Barney, Gumble, debit
4, Waylon, Smithers, cash
5, Ned, Flanders, debit