Skip to content

SeakMengs/AutoCert

Repository files navigation

AutoCert

A Variable Data Printing, E-Signing, and Certificate Repository Platform.

Develop

Clone the project including its submodule

git clone --recursive https://github.com/SeakMengs/AutoCert.git

Note: To update the submodule to the latest commit, run the following command

git submodule update --recursive --remote

Development is divided into two environment, docker and local.

Docker environment

The docker environment in this project has everything set up including live reload, postgresql.

To develop using docker, make sure you have docker installed then run the following command:

docker compose up

To perform some command within the docker environment you can mount into the docker bash with the following command

First get the name of the docker image with the following command

docker ps -l

# Output should look something like this
# CONTAINER ID   IMAGE                   COMMAND              CREATED             STATUS                         PORTS                    NAMES
# 07ec003243de   autocert-autocert-api   "air -c .air.toml"   About an hour ago   Up About an hour (unhealthy)   0.0.0.0:8080->8080/tcp   autocert-autocert-api-1

To mount into the docker bash run the following command

docker exec -it autocert-autocert-api-1 bash

After mount into docker bash, you can perform some action such as migration.

cd /app
go run ./cmd/migrate/main.go

Local development

Develop local with hot reload

air

Develop local without hot reload

go run ./cmd/api/main.go

Migrate database

go run ./cmd/migrate/main.go

Information about the project

Package autocert

This package is written on top of existing libraries such as tdewolff/canvas, pdfcpu and is written to rely on font_metadata.json which is generated by scanning the font folder using the following command

go run ./cmd/scan_font`

Testing

Unit test

To run all unit tests

go test ./...

To test rate limit

go test ./internal/rate_limiter

To test mail

go test ./internal/mailer

Script test

To test rate limit by performing http request

./scripts/test_rate_limit.sh

Production deployment

For production deployment check deploy.md

About

A Variable Data Printing, E-Signing, and Certificate Repository Platform

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages