public | ||
server | ||
.gitignore | ||
.sample.env | ||
Dockerfile | ||
Makefile | ||
README.org |
Conex Builder Documentation
Database
Create DB
sudo su - postgres
psql
Then:
CREATE DATABASE iterone OWNER conex;
Sites table
DROP TABLE IF EXISTS changes;
DROP TABLE IF EXISTS payments;
DROP TABLE IF EXISTS sites;
CREATE TABLE sites (
id SERIAL PRIMARY KEY,
folder VARCHAR(35) UNIQUE NOT NULL,
status VARCHAR(4),
due TIMESTAMPTZ NOT NULL,
name VARCHAR(50),
sur VARCHAR(50),
email VARCHAR(100) NOT NULL,
phone VARCHAR(20),
code VARCHAR(2),
title VARCHAR(35) NOT NULL,
slogan VARCHAR(100),
tags TEXT,
banner TEXT,
raw JSONB NOT NULL,
auth INTEGER,
valid TIMESTAMPTZ
);
SELECT * FROM sites;
id | folder | status | due | name | sur | phone | code | title | slogan | banner | raw | auth | valid |
Payments table
DROP TABLE IF EXISTS changes;
DROP TABLE IF EXISTS payments;
CREATE TABLE payments (
id SERIAL PRIMARY KEY,
capture VARCHAR(100) NOT NULL,
site INTEGER REFERENCES sites(id) NOT NULL,
amount DECIMAL(10, 2) NOT NULL,
currency VARCHAR(3) NOT NULL,
status VARCHAR(18) NOT NULL, -- PayPal capture status length -- https://developer.paypal.com/docs/api/orders/v2/#orders_capture
date TIMESTAMPTZ NOT NULL
);
SELECT * FROM payments;
id | capture | site | amount | currency | status | date |
Error codes
http.Error
Fatalf
Fatal error will cause program shutdown by calling os.Exit(1)
.
Error 000: Missing credentials
Package: main
Function: init()
Libraries: os
, log
, github.com/joho/godotenv
Authentication and other parameters are located in the .env
file which mist be
located at the root of main binary execution.
Possible causes for error are:
- Binary execution directory doesn't have the
.env
file - Missing parameters for initializing environment values
- Corruption of
.env
file - Library error
Steps to troubleshoot:
- Check
.env
exists - Check
.env
authentication values - Check
.env
file integrity - Update, rollback or troubleshoot library
Error 001: Can't connect to database
Package: main
Function: init()
Libraries: os
, log
The db
object manages database queries. This object is used to ping the
database, a correct ping depends on correctly set credentials, and properly
initialized db
object.
Possible causes for error are:
- Wrong database credentials
- Missing database credentials
Steps to troubleshoot:
- Check set, correct and valid credentials in
.env
file
Error: 002: Can't start server
Package: main
Function: main()
Libraries: os
, log
, net/http
, os/signal
The server runs in a Goroutine, started on a port defined in .env
.
Possible causes for error are:
- Port is in use
- Port usage denied
Steps to troubleshoot:
- Check set, correct and valid port in
.env
file