add harbor network to adminserver

This commit is contained in:
Wenkai Yin 2017-02-24 14:14:36 +08:00
parent 414e8a8bcf
commit 9f3f48be59
3 changed files with 10 additions and 12 deletions

View File

@ -56,6 +56,8 @@ services:
volumes:
- /data/config/:/etc/adminserver/
- /data/secretkey:/etc/adminserver/key
networks:
- harbor
depends_on:
- log
logging:

View File

@ -33,23 +33,13 @@ import (
)
const (
issuer = "registry-token-issuer"
defaultTokenExpiration = 30
issuer = "registry-token-issuer"
)
var expiration int //minutes
var privateKey string
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"
log.Infof("token expiration: %d minutes", expiration)
}
// GetResourceActions ...

View File

@ -14,9 +14,16 @@ import (
"path"
"runtime"
"testing"
"github.com/vmware/harbor/src/common/utils/log"
"github.com/vmware/harbor/src/ui/config"
)
func TestMain(m *testing.M) {
if err := config.Init(); err != nil {
log.Fatalf("failed to initialize configurations: %v", err)
}
result := m.Run()
if result != 0 {
os.Exit(result)
@ -73,7 +80,6 @@ func TestMakeToken(t *testing.T) {
pk, crt := getKeyAndCertPath()
//overwrite the config values for testing.
privateKey = pk
expiration = 10
ra := []*token.ResourceActions{&token.ResourceActions{
Type: "repository",
Name: "10.117.4.142/notary-test/hello-world-2",