用于 Gin & React 项目的模板. Template for Gin & React projects.
MIT License
✨ Template for Gin & React projects ✨
git clone https://github.com/songquanpeng/gin-template.git
go mod download
go build -ldflags "-s -w" -o gin-template
chmod u+x gin-template
./gin-template --port 3000 --log-dir ./logs
root
and the password is 123456
.Execute: docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/gin-template:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/gin-template
Data will be saved in /home/ubuntu/data/gin-template
.
The system works out of the box.
You can configure the system by set environment variables or specify command line arguments.
After the system starts, use root
user to log in to the system and do further configuration.
REDIS_CONN_STRING
: when set, Redis will be used as the storage for request rate limitation instead of memory storage.
REDIS_CONN_STRING=redis://default:redispw@localhost:49153
SESSION_SECRET
: when set, a fixed session key will be used so that the logged-in users' cookie remains valid across system reboots.
SESSION_SECRET=random_string
SQL_DSN
: when set, the target SQL database will be used instead of SQLite.
SQL_DSN=root:123456@tcp(localhost:3306)/gin-template
--port <port_number>
: specify the port number, the default value is 3000
.
--port 3000
--log-dir <log_dir>
: specify the log dir, if not set, the log won't be saved.
--log-dir ./logs
--version
: print the version and exit.