mirror of
https://github.com/goharbor/harbor.git
synced 2024-09-29 05:47:31 +02:00
add harbor network to adminserver
This commit is contained in:
parent
414e8a8bcf
commit
9f3f48be59
@ -56,6 +56,8 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- /data/config/:/etc/adminserver/
|
- /data/config/:/etc/adminserver/
|
||||||
- /data/secretkey:/etc/adminserver/key
|
- /data/secretkey:/etc/adminserver/key
|
||||||
|
networks:
|
||||||
|
- harbor
|
||||||
depends_on:
|
depends_on:
|
||||||
- log
|
- log
|
||||||
logging:
|
logging:
|
||||||
|
@ -33,23 +33,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
issuer = "registry-token-issuer"
|
issuer = "registry-token-issuer"
|
||||||
defaultTokenExpiration = 30
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var expiration int //minutes
|
|
||||||
var privateKey string
|
var privateKey string
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
var err error
|
|
||||||
expiration, err = config.TokenExpiration()
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("failed to get token expiration: %v, will use the default value %d",
|
|
||||||
err, defaultTokenExpiration)
|
|
||||||
expiration = defaultTokenExpiration
|
|
||||||
}
|
|
||||||
privateKey = "/etc/ui/private_key.pem"
|
privateKey = "/etc/ui/private_key.pem"
|
||||||
log.Infof("token expiration: %d minutes", expiration)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetResourceActions ...
|
// GetResourceActions ...
|
||||||
|
@ -14,9 +14,16 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/vmware/harbor/src/common/utils/log"
|
||||||
|
"github.com/vmware/harbor/src/ui/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
|
if err := config.Init(); err != nil {
|
||||||
|
log.Fatalf("failed to initialize configurations: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
result := m.Run()
|
result := m.Run()
|
||||||
if result != 0 {
|
if result != 0 {
|
||||||
os.Exit(result)
|
os.Exit(result)
|
||||||
@ -73,7 +80,6 @@ func TestMakeToken(t *testing.T) {
|
|||||||
pk, crt := getKeyAndCertPath()
|
pk, crt := getKeyAndCertPath()
|
||||||
//overwrite the config values for testing.
|
//overwrite the config values for testing.
|
||||||
privateKey = pk
|
privateKey = pk
|
||||||
expiration = 10
|
|
||||||
ra := []*token.ResourceActions{&token.ResourceActions{
|
ra := []*token.ResourceActions{&token.ResourceActions{
|
||||||
Type: "repository",
|
Type: "repository",
|
||||||
Name: "10.117.4.142/notary-test/hello-world-2",
|
Name: "10.117.4.142/notary-test/hello-world-2",
|
||||||
|
Loading…
Reference in New Issue
Block a user