Skip to content

Commit

Permalink
docs: update configuration file with rate limit settings
Browse files Browse the repository at this point in the history
  • Loading branch information
funnyzak committed Feb 18, 2024
1 parent 2f7425e commit 73166ea
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 14 deletions.
72 changes: 71 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Go Gin

Gin gonic starter with zerolog, viper, gorm, jwt, go-cache, cron, notification, etc.
Gin gonic starter with zerolog, viper, gorm, jwt, go-cache, rate-limit, cron, notification, etc.

[![Build Status][build-status-image]][build-status]
[![license][license-image]][repository-url]
Expand Down Expand Up @@ -75,6 +75,76 @@ You can fork this repository and add Secrets Keys: `DOCKER_USERNAME` and `DOCKER
└── singleton // Singleton services for the application
```

## Configuration

The configuration file is in the `config.yaml` file, you can copy the `config.yaml.example` file to `config.yaml` and update the values, the configuration file is as follows:

```yaml
server:
port: 8080 # Server port
site:
brand: Go-Gin # Site brand
description: A simple web application using Go and Gin # Site description
base_url: http://localhost:8080 # Site base URL, used for generating absolute URLs
debug: false # Debug mode, if true, the server will print detailed error messages
log:
level: debug # debug, info, warn, error, fatal, panic
path: logs/go-gin.log # Log file path
db_path: db/go-gin.sqlite # Database path
rate_limit:
max: 100 # requests per minute
upload:
dir: upload # Upload directory
max_size: 10485760 # 10MB
jwt: # JWT settings
access_secret: qhkxjrRmYcVYKSEobqsvhxhtPVeTWquu # Access token secret
refresh_secret: qhkxjrRmYcVYKSEobqsvhxhtPV3TWquu # Refresh token secret
access_token_expiration: 60 # minutes
refresh_token_expiration: 720 # minutes
access_token_cookie_name: go-gin-access # Access token cookie name
refresh_token_cookie_name: go-gin-refresh # Refresh token cookie name
location: Asia/Chongqing # Timezone
notifications: # Notification settings
- type: apprise # You must install apprise first, more details: https://github.com/caronc/apprise
instances:
- url: "apprise-url-1"
- url: "apprise-url-2"
- type: dingtalk
instances:
- webhook: "dingtalk-webhook-1"
- webhook: "dingtalk-webhook-2"
- type: ifttt
instances:
- key: "ifttt-key-1"
event: "event-1"
- key: "ifttt-key-2"
event: "event-2"
- type: smtp
instances:
- host: "smtp-host-1"
port: 587
username: "user-1"
password: "password-1"
from: "from-1"
to: "to-1"
- host: "smtp-host-2"
port: 587
username: "user-2"
password: "password-2"
from: "from-2"
to: "to-2"
- type: telegram
instances:
- botToken: "telegram-bot-token-1"
chatID: "chat-id-1"
- botToken: "telegram-bot-token-2"
chatID: "chat-id-2"
- type: wecom
instances:
- key: "wecom-key-1"
- key: "wecom-key-2"
```

## Build

```bash
Expand Down
19 changes: 6 additions & 13 deletions config.yaml.example
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
server:
port: 8080

port: 8080 # Server port
site:
brand: Go-Gin
description: A simple web application using Go and Gin
base_url: http://localhost:8080

debug: false

brand: Go-Gin # Site brand
description: A simple web application using Go and Gin # Site description
base_url: http://localhost:8080 # Site base URL, used for generating absolute URLs
debug: false # Debug mode, if true, the server will print detailed error messages
log:
level: debug # debug, info, warn, error, fatal, panic
path: logs/go-gin.log # Log file path

db_path: db/go-gin.sqlite # Database path

rate_limit:
max: 100 # requests per minute

upload:
dir: upload # Upload directory
max_size: 10485760 # 10MB

jwt: # JWT settings
access_secret: qhkxjrRmYcVYKSEobqsvhxhtPVeTWquu # Access token secret
refresh_secret: qhkxjrRmYcVYKSEobqsvhxhtPV3TWquu # Refresh token secret
Expand All @@ -30,7 +23,7 @@ jwt: # JWT settings
refresh_token_cookie_name: go-gin-refresh # Refresh token cookie name
location: Asia/Chongqing # Timezone
notifications: # Notification settings
- type: apprise # You must install apprise first
- type: apprise # You must install apprise first, more details: https://github.com/caronc/apprise
instances:
- url: "apprise-url-1"
- url: "apprise-url-2"
Expand Down

0 comments on commit 73166ea

Please sign in to comment.