暫無描述

JustSong 5e8c22fbf6 Update system log 2 年之前
.github 539eac217f Rename to One API 2 年之前
common 5e8c22fbf6 Update system log 2 年之前
controller 6164829239 Channel API done without verification 2 年之前
middleware 539eac217f Rename to One API 2 年之前
model 6164829239 Channel API done without verification 2 年之前
router 6164829239 Channel API done without verification 2 年之前
web af96007025 Remove useless page 2 年之前
.gitignore ab1f8a2bf4 Initial commit 2 年之前
Dockerfile 539eac217f Rename to One API 2 年之前
LICENSE ab1f8a2bf4 Initial commit 2 年之前
README.en.md 539eac217f Rename to One API 2 年之前
README.md 539eac217f Rename to One API 2 年之前
go.mod 539eac217f Rename to One API 2 年之前
go.sum ab1f8a2bf4 Initial commit 2 年之前
main.go 5e8c22fbf6 Update system log 2 年之前

README.en.md

中文 | English

one-api logo

# Gin Template _✨ Template for Gin & React projects ✨_

license release release GoReportCard

Download · Tutorial · Feedback · Demo

Features

  • Built-in user management.
  • Built-in file management.
  • GitHub OAuth.
  • WeChat official account authorization (need wechat-server).
  • Email verification & password reset.
  • Request rate limiting.
  • Static files caching.
  • Mobile friendly UI.
  • Token based authorization.
  • Use GitHub Actions to build releases & Docker images.
  • Cloudflare Turnstile user validation.

Deployment

Manual deployment

  1. Download built binary from GitHub Releases or build from source: shell git clone https://github.com/songquanpeng/one-api.git go mod download go build -ldflags "-s -w" -o one-api 2. Run it: shell chmod u+x one-api ./one-api --port 3000 --log-dir ./logs 3. Visit [http://localhost:3000/](http://localhost:3000/) and login. The username for the initial account isrootand the password is123456. ### Deploy with Docker Execute:docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/one-api:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/one-api Data will be saved in/home/ubuntu/data/one-api. ## Configurations 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, userootuser to log in to the system and do further configuration. ### Environment Variables 1.REDIS_CONN_STRING: when set, Redis will be used as the storage for request rate limitation instead of memory storage. + Example:REDIS_CONN_STRING=redis://default:redispw@localhost:49153 2.SESSION_SECRET: when set, a fixed session key will be used so that the logged-in users' cookie remains valid across system reboots. + Example:SESSION_SECRET=random_string 3.SQL_DSN: when set, the target SQL database will be used instead of SQLite. + Example:SQL_DSN=root:123456@tcp(localhost:3306)/one-api ### Command line Arguments 1.--port : specify the port number, the default value is3000. + Example:--port 3000 2.--log-dir : specify the log dir, if not set, the log won't be saved. + Example:--log-dir ./logs 3.--version`: print the version and exit.