cricket 蟋蟀、蛐蛐
- 生成1024位的公钥
openssl genrsa -out private.pem 1024
- 根据公钥生成对应的私钥
openssl rsa -in private.pem -pubout -out public.pem
1024不够安全,可以用2048
- 初始化
govendor init
- 获取特定版本的依赖
govendor fetch github.com/dgrijalva/[email protected]
govendor fetch github.com/astaxie/beego/[email protected]
govendor fetch github.com/lib/[email protected]
govendor fetch github.com/go-redis/[email protected]
govendor fetch github.com/gin-gonic/[email protected]
- 最low的运行方式:
go run main.go models.go
- 运行package(相对于$GOPATH或$GOROOT):
go run github.com\kotocean\cricket\auth
- 测试:
cd auth/db && go test -v
docker run --name postgresql -p 5432:5432 -e POSTGRESQL_USERNAME=my_user -e POSTGRESQL_PASSWORD=password123 -e POSTGRESQL_DATABASE=cricket_db bitnami/postgresql:10
- 登录
psql cricket_db my_user
- 创建person表
create table person (
id serial,
name varchar(20),
password varchar(20)
);
- 创建record表
create table record (
id serial,
client_mark varchar(320),
token varchar(320),
expires_at bigint,
valid boolean
);
- 创建client表
create table client (
id serial,
client_id varchar(20),
secret varchar(128)
);
docker run --name redis -d -p 6379:6379 redis:alpine3.8
默认没有密码,localhost登录