mirror of
https://github.com/goharbor/harbor
synced 2025-04-06 15:51:29 +00:00
Change codes to make everything OK after upgrading to beego 1.9.0
This commit is contained in:
parent
e7b431899e
commit
10f56d26fe
|
@ -34,8 +34,8 @@ func AuthModeCanBeModified() (bool, error) {
|
|||
func GetConfigEntries() ([]*models.ConfigEntry, error) {
|
||||
o := GetOrmer()
|
||||
var p []*models.ConfigEntry
|
||||
sql:="select * from properties"
|
||||
n,err := o.Raw(sql,[]interface{}{}).QueryRows(&p)
|
||||
sql := "select * from properties"
|
||||
n, err := o.Raw(sql, []interface{}{}).QueryRows(&p)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -44,27 +44,27 @@ func GetConfigEntries() ([]*models.ConfigEntry, error) {
|
|||
if n == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return p,nil
|
||||
return p, nil
|
||||
}
|
||||
|
||||
// SaveConfigEntries Save configuration to database.
|
||||
func SaveConfigEntries(entries []models.ConfigEntry) error{
|
||||
func SaveConfigEntries(entries []models.ConfigEntry) error {
|
||||
o := GetOrmer()
|
||||
tempEntry:=models.ConfigEntry{}
|
||||
for _, entry := range entries{
|
||||
for _, entry := range entries {
|
||||
tempEntry := models.ConfigEntry{}
|
||||
tempEntry.Key = entry.Key
|
||||
tempEntry.Value = entry.Value
|
||||
created, _, error := o.ReadOrCreate(&tempEntry,"k")
|
||||
created, _, error := o.ReadOrCreate(&tempEntry, "k")
|
||||
if error != nil {
|
||||
return error
|
||||
}
|
||||
if !created {
|
||||
entry.ID = tempEntry.ID
|
||||
_ ,err := o.Update(&entry,"v")
|
||||
_, err := o.Update(&entry, "v")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ type Project struct {
|
|||
OwnerID int `orm:"column(owner_id)" json:"owner_id"`
|
||||
Name string `orm:"column(name)" json:"name"`
|
||||
CreationTime time.Time `orm:"column(creation_time)" json:"creation_time"`
|
||||
UpdateTime time.Time `orm:"update_time" json:"update_time"`
|
||||
UpdateTime time.Time `orm:"column(update_time)" json:"update_time"`
|
||||
Deleted int `orm:"column(deleted)" json:"deleted"`
|
||||
OwnerName string `orm:"-" json:"owner_name"`
|
||||
Togglable bool `orm:"-" json:"togglable"`
|
||||
|
|
|
@ -29,5 +29,5 @@ type Role struct {
|
|||
RoleCode string `orm:"column(role_code)" json:"role_code"`
|
||||
Name string `orm:"column(name)" json:"role_name"`
|
||||
|
||||
RoleMask int `orm:"role_mask" json:"role_mask"`
|
||||
RoleMask int `orm:"column(role_mask)" json:"role_mask"`
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ type User struct {
|
|||
HasAdminRole int `orm:"column(sysadmin_flag)" json:"has_admin_role"`
|
||||
ResetUUID string `orm:"column(reset_uuid)" json:"reset_uuid"`
|
||||
Salt string `orm:"column(salt)" json:"-"`
|
||||
CreationTime time.Time `orm:"creation_time" json:"creation_time"`
|
||||
UpdateTime time.Time `orm:"update_time" json:"update_time"`
|
||||
CreationTime time.Time `orm:"column(creation_time)" json:"creation_time"`
|
||||
UpdateTime time.Time `orm:"column(update_time)" json:"update_time"`
|
||||
}
|
||||
|
||||
// UserQuery ...
|
||||
|
|
|
@ -16,7 +16,6 @@ package filter
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
@ -43,21 +42,18 @@ import (
|
|||
|
||||
func TestMain(m *testing.M) {
|
||||
// initialize beego session manager
|
||||
conf := map[string]interface{}{
|
||||
"cookieName": beego.BConfig.WebConfig.Session.SessionName,
|
||||
"gclifetime": beego.BConfig.WebConfig.Session.SessionGCMaxLifetime,
|
||||
"providerConfig": filepath.ToSlash(beego.BConfig.WebConfig.Session.SessionProviderConfig),
|
||||
"secure": beego.BConfig.Listen.EnableHTTPS,
|
||||
"enableSetCookie": beego.BConfig.WebConfig.Session.SessionAutoSetCookie,
|
||||
"domain": beego.BConfig.WebConfig.Session.SessionDomain,
|
||||
"cookieLifeTime": beego.BConfig.WebConfig.Session.SessionCookieLifeTime,
|
||||
}
|
||||
confBytes, err := json.Marshal(conf)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to marshal session conf: %v", err)
|
||||
conf := &session.ManagerConfig{
|
||||
CookieName: beego.BConfig.WebConfig.Session.SessionName,
|
||||
Gclifetime: beego.BConfig.WebConfig.Session.SessionGCMaxLifetime,
|
||||
ProviderConfig: filepath.ToSlash(beego.BConfig.WebConfig.Session.SessionProviderConfig),
|
||||
Secure: beego.BConfig.Listen.EnableHTTPS,
|
||||
EnableSetCookie: beego.BConfig.WebConfig.Session.SessionAutoSetCookie,
|
||||
Domain: beego.BConfig.WebConfig.Session.SessionDomain,
|
||||
CookieLifeTime: beego.BConfig.WebConfig.Session.SessionCookieLifeTime,
|
||||
}
|
||||
|
||||
beego.GlobalSessions, err = session.NewManager("memory", string(confBytes))
|
||||
var err error
|
||||
beego.GlobalSessions, err = session.NewManager("memory", conf)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create session manager: %v", err)
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@ cp tests/docker-compose.test.yml make/.
|
|||
mkdir -p /etc/ui
|
||||
cp make/common/config/ui/private_key.pem /etc/ui/.
|
||||
|
||||
mkdir conf
|
||||
cp make/common/config/ui/app.conf conf/.
|
||||
mkdir src/ui/conf
|
||||
cp make/common/config/ui/app.conf src/ui/conf/.
|
||||
IP=`ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}'`
|
||||
echo "server ip is "$IP
|
||||
sed -i -r "s/MYSQL_HOST=mysql/MYSQL_HOST=$IP/" make/common/config/adminserver/env
|
||||
|
|
Loading…
Reference in New Issue
Block a user