schablone-server

command module
v0.0.0-...-d69d474 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: AGPL-3.0 Imports: 10 Imported by: 0

README

schablone-server

Documentation API

The documentation of the API can be accessed right here.

Screenshot: text

Use this firefox Add-On to execute requests on the documentation.

Installation Using Docker

Prerequisites: You need to have Docker and Docker Compose installed.
# Clone Repo
git clone git@github.com:Alone2/schablone-server.git
cd schablone-server

# Set mysql root password
read password
echo "MARIADB_ROOT_PASSWORD=$password
MARIADB_USER_PASSWORD=$password
MARIADB_USER_NAME=root
MARIADB_HOST=mariadb" > .mariadb.env

# Start server
docker-compose up -d

Usage

Sign in with the default password:

curl "http://0.0.0.0:8080/user/login?username=admin&password=12345"

Debugging

Connect to Database (Docker)
docker-compose exec mariadb sh -c 'mysql -h 0.0.0.0 -u root -p '
Populate Database With Quicktext Data
Prerequisites: You need to have python 3 installed and already have followed the following instructions:
# GET API token
curl "http://0.0.0.0:8080/user/login?username=admin&password=12345"

# Set it
API_TOKEN="INSERT_TOKEN_HERE"

# Import scripts
./scripts/schablone-server-client/import_macros.py http://localhost:8080 ${API_TOKEN} quicktext_module.xml
./scripts/schablone-server-client/import_templates.py http://localhost:8080 ${API_TOKEN} quicktext_template.xml
DB Schema
The database SQL CREATE file (as well as the MySQL Workbench file) is in the ./db folder:

Development

Generate OpenApi Code
~/go/bin/oapi-codegen --generate types --package=api schablone-api.yaml > api/types.gen.go
~/go/bin/oapi-codegen --generate chi-server --package=api schablone-api.yaml > api/chi-server.gen.go
~/go/bin/oapi-codegen --generate spec --package=api schablone-api.yaml > api/spec.gen.go
Install Go Dependencies (Local Install)
go get .
go test
Python scripts
Setup virtual environement and install dependencies:
cd scripts
python -m venv schablone-python
source schablone-python/bin/activate
pip install -r requirements.txt

Update python client api:

cd scripts
source schablone-python/bin/activate
openapi-python-client update --path ../schablone-api.yaml

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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