mirror of
https://github.com/goharbor/harbor.git
synced 2024-06-21 04:15:07 +02:00
Change codes to make everything OK after upgrading to beego 1.9.0
This commit is contained in:
parent
e7b431899e
commit
10f56d26fe
|
@ -50,8 +50,8 @@ func GetConfigEntries() ([]*models.ConfigEntry, error) {
|
|||
// SaveConfigEntries Save configuration to database.
|
||||
func SaveConfigEntries(entries []models.ConfigEntry) error {
|
||||
o := GetOrmer()
|
||||
tempEntry:=models.ConfigEntry{}
|
||||
for _, entry := range entries {
|
||||
tempEntry := models.ConfigEntry{}
|
||||
tempEntry.Key = entry.Key
|
||||
tempEntry.Value = entry.Value
|
||||
created, _, error := o.ReadOrCreate(&tempEntry, "k")
|
||||
|
|
|
@ -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