Compare commits
No commits in common. "1dfd96869dac822501909aa13a5b4479adbb2e17" and "924f76a100dc18e6c67f637b8dbf21259b9db190" have entirely different histories.
1dfd96869d
...
924f76a100
@ -1,46 +0,0 @@
|
|||||||
root = "."
|
|
||||||
testdata_dir = "testdata"
|
|
||||||
tmp_dir = "tmp"
|
|
||||||
|
|
||||||
[build]
|
|
||||||
args_bin = []
|
|
||||||
bin = "tmp\\main"
|
|
||||||
cmd = "go build -o ./tmp/main ."
|
|
||||||
delay = 1000
|
|
||||||
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
|
|
||||||
exclude_file = []
|
|
||||||
exclude_regex = ["_test.go"]
|
|
||||||
exclude_unchanged = false
|
|
||||||
follow_symlink = false
|
|
||||||
full_bin = ""
|
|
||||||
include_dir = []
|
|
||||||
include_ext = ["go", "tpl", "tmpl", "html"]
|
|
||||||
include_file = []
|
|
||||||
kill_delay = "0s"
|
|
||||||
log = "build-errors.log"
|
|
||||||
poll = false
|
|
||||||
poll_interval = 0
|
|
||||||
post_cmd = []
|
|
||||||
pre_cmd = []
|
|
||||||
rerun = false
|
|
||||||
rerun_delay = 500
|
|
||||||
send_interrupt = false
|
|
||||||
stop_on_error = false
|
|
||||||
|
|
||||||
[color]
|
|
||||||
app = ""
|
|
||||||
build = "yellow"
|
|
||||||
main = "magenta"
|
|
||||||
runner = "green"
|
|
||||||
watcher = "cyan"
|
|
||||||
|
|
||||||
[log]
|
|
||||||
main_only = false
|
|
||||||
time = false
|
|
||||||
|
|
||||||
[misc]
|
|
||||||
clean_on_exit = false
|
|
||||||
|
|
||||||
[screen]
|
|
||||||
clear_on_rebuild = false
|
|
||||||
keep_scroll = true
|
|
@ -1,3 +1,3 @@
|
|||||||
tmp
|
tmp
|
||||||
docker-compose.yaml
|
docker-compose.yaml
|
||||||
.air*.toml
|
.air.toml
|
@ -1,18 +0,0 @@
|
|||||||
steps:
|
|
||||||
- name: build latest
|
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
|
||||||
settings:
|
|
||||||
repo: registry.odit.services/lfk/document-server
|
|
||||||
tags:
|
|
||||||
- latest
|
|
||||||
registry: registry.odit.services
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
cache_from: registry.odit.services/lfk/document-server:latest
|
|
||||||
username:
|
|
||||||
from_secret: odit-registry-builder-username
|
|
||||||
password:
|
|
||||||
from_secret: odit-registry-builder-password
|
|
||||||
when:
|
|
||||||
branch: main
|
|
||||||
when:
|
|
||||||
event: push
|
|
@ -1,17 +0,0 @@
|
|||||||
steps:
|
|
||||||
- name: build tag
|
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
|
||||||
settings:
|
|
||||||
repo: registry.odit.services/lfk/document-server
|
|
||||||
tags:
|
|
||||||
- "${CI_COMMIT_TAG}"
|
|
||||||
registry: registry.odit.services
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
cache_from: registry.odit.services/lfk/document-server:latest
|
|
||||||
username:
|
|
||||||
from_secret: odit-registry-builder-username
|
|
||||||
password:
|
|
||||||
from_secret: odit-registry-builder-password
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- tag
|
|
47
README.md
47
README.md
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- 📝 HTML templates for pdf generation
|
- 📝 HTML pdf templates
|
||||||
- 📚 OpenAPI/Swagger documentation
|
- 📚 OpenAPI/Swagger documentation
|
||||||
- ⚡ High-performance with go and gotenberg
|
- ⚡ High-performance with go and gotenberg
|
||||||
|
|
||||||
@ -12,6 +12,9 @@
|
|||||||
# Install dependencies
|
# Install dependencies
|
||||||
go mod download
|
go mod download
|
||||||
|
|
||||||
|
# Generate the swagger docs
|
||||||
|
swag init
|
||||||
|
|
||||||
# Run the server
|
# Run the server
|
||||||
air
|
air
|
||||||
```
|
```
|
||||||
@ -26,45 +29,3 @@ The project uses:
|
|||||||
|
|
||||||
- 🏃♂️ go as the language and build tool
|
- 🏃♂️ go as the language and build tool
|
||||||
- 🌐 gofiber for the web framework
|
- 🌐 gofiber for the web framework
|
||||||
- 📦 air for live reload
|
|
||||||
- 📝 swaggo for API documentation
|
|
||||||
- 📄 gotenberg for HTML to PDF conversion
|
|
||||||
|
|
||||||
### 📦 Use docker compose for external dependencies
|
|
||||||
|
|
||||||
```shell
|
|
||||||
docker compose -f docker-compose.dev.yaml up
|
|
||||||
```
|
|
||||||
|
|
||||||
### 🏃 Run via air
|
|
||||||
|
|
||||||
> Install air via `go install github.com/air-verse/air@latest`
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# With the default air config
|
|
||||||
air
|
|
||||||
|
|
||||||
# With the config for linux/macOS
|
|
||||||
air -c .air.linux.toml
|
|
||||||
|
|
||||||
# With the config for windows
|
|
||||||
air -c .air.windows.toml
|
|
||||||
```
|
|
||||||
|
|
||||||
### ✒️ Update the swagger docs
|
|
||||||
|
|
||||||
> Install swag via `go install github.com/swaggo/swag/cmd/swag@latest`
|
|
||||||
|
|
||||||
```shell
|
|
||||||
swag init
|
|
||||||
```
|
|
||||||
|
|
||||||
### 🐋 Build container
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# single arch
|
|
||||||
docker build -t registry.odit.services/lfk/document-server:latest .
|
|
||||||
|
|
||||||
# multiarch
|
|
||||||
docker buildx build --platform=linux/amd64,linux/arm64 -t registry.odit.services/lfk/document-server:latest --push .
|
|
||||||
```
|
|
||||||
|
12
docs/docs.go
12
docs/docs.go
@ -320,19 +320,7 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"securityDefinitions": {
|
|
||||||
"ApiKeyAuth": {
|
|
||||||
"type": "apiKey",
|
|
||||||
"name": "key",
|
|
||||||
"in": "query"
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"ApiKeyAuth": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}`
|
}`
|
||||||
|
|
||||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||||
|
@ -311,17 +311,5 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"securityDefinitions": {
|
|
||||||
"ApiKeyAuth": {
|
|
||||||
"type": "apiKey",
|
|
||||||
"name": "key",
|
|
||||||
"in": "query"
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"ApiKeyAuth": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
@ -211,11 +211,4 @@ paths:
|
|||||||
summary: Generate a contract
|
summary: Generate a contract
|
||||||
tags:
|
tags:
|
||||||
- contracts
|
- contracts
|
||||||
security:
|
|
||||||
- ApiKeyAuth: []
|
|
||||||
securityDefinitions:
|
|
||||||
ApiKeyAuth:
|
|
||||||
in: query
|
|
||||||
name: key
|
|
||||||
type: apiKey
|
|
||||||
swagger: "2.0"
|
swagger: "2.0"
|
||||||
|
4
main.go
4
main.go
@ -57,9 +57,6 @@ func loadEnv() error {
|
|||||||
|
|
||||||
// @title LfK Document Server API
|
// @title LfK Document Server API
|
||||||
// @description This is the API documentation for the LfK Document Server - a tool for pdf generation.
|
// @description This is the API documentation for the LfK Document Server - a tool for pdf generation.
|
||||||
// @securityDefinitions.apiKey ApiKeyAuth
|
|
||||||
// @in query
|
|
||||||
// @name key
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
err := loadEnv()
|
err := loadEnv()
|
||||||
@ -79,7 +76,6 @@ func main() {
|
|||||||
// Swagger documentation route
|
// Swagger documentation route
|
||||||
app.Get("/swagger/*", swagger.HandlerDefault)
|
app.Get("/swagger/*", swagger.HandlerDefault)
|
||||||
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
v1 := app.Group("/v1")
|
v1 := app.Group("/v1")
|
||||||
v1.Use(keyauth.New(keyauth.Config{
|
v1.Use(keyauth.New(keyauth.Config{
|
||||||
KeyLookup: "query:key",
|
KeyLookup: "query:key",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user