mirror of
https://github.com/go-gitea/gitea
synced 2025-07-26 20:28:40 +00:00
chore: fix token format
This commit is contained in:
@@ -29,7 +29,7 @@ func (err ErrRunnerTokenNotExist) Error() string {
|
||||
// RunnerToken represents runner tokens
|
||||
type RunnerToken struct {
|
||||
ID int64
|
||||
Token string `xorm:"CHAR(36) UNIQUE"`
|
||||
Token string `xorm:"UNIQUE"`
|
||||
OwnerID int64 `xorm:"index"` // org level runner, 0 means system
|
||||
Owner *user_model.User `xorm:"-"`
|
||||
RepoID int64 `xorm:"index"` // repo level runner, if orgid also is zero, then it's a global
|
||||
@@ -81,8 +81,7 @@ func NewRunnerToken(ownerID, repoID int64) (*RunnerToken, error) {
|
||||
OwnerID: ownerID,
|
||||
RepoID: repoID,
|
||||
IsActive: false,
|
||||
// FIXME: why token is 36 chars?
|
||||
Token: base.EncodeSha1(gouuid.New().String())[:36],
|
||||
Token: base.EncodeSha1(gouuid.New().String()),
|
||||
}
|
||||
_, err := db.GetEngine(db.DefaultContext).Insert(runnerToken)
|
||||
return runnerToken, err
|
||||
|
@@ -21,7 +21,11 @@ func addBotTables(x *xorm.Engine) error {
|
||||
Description string `xorm:"TEXT"`
|
||||
Base int // 0 native 1 docker 2 virtual machine
|
||||
RepoRange string // glob match which repositories could use this runner
|
||||
Token string `xorm:"CHAR(36) UNIQUE"`
|
||||
|
||||
Token string `xorm:"-"`
|
||||
TokenHash string `xorm:"UNIQUE"` // sha256 of token
|
||||
TokenSalt string
|
||||
// TokenLastEight string `xorm:"token_last_eight"` // it's unnecessary because we don't find runners by token
|
||||
|
||||
// instance status (idle, active, offline)
|
||||
Status int32
|
||||
@@ -38,7 +42,7 @@ func addBotTables(x *xorm.Engine) error {
|
||||
|
||||
type BotsRunnerToken struct {
|
||||
ID int64
|
||||
Token string `xorm:"CHAR(36) UNIQUE"`
|
||||
Token string `xorm:"UNIQUE"`
|
||||
OwnerID int64 `xorm:"index"` // org level runner, 0 means system
|
||||
RepoID int64 `xorm:"index"` // repo level runner, if orgid also is zero, then it's a global
|
||||
IsActive bool
|
||||
|
Reference in New Issue
Block a user