implement cache.advertise_url
This commit is contained in:
@@ -17,9 +17,10 @@ import (
|
||||
)
|
||||
|
||||
type cacheServerArgs struct {
|
||||
Dir string
|
||||
Host string
|
||||
Port uint16
|
||||
Dir string
|
||||
AdvertiseUrl string
|
||||
Host string
|
||||
Port uint16
|
||||
}
|
||||
|
||||
func runCacheServer(ctx context.Context, configFile *string, cacheArgs *cacheServerArgs) func(cmd *cobra.Command, args []string) error {
|
||||
@@ -33,6 +34,7 @@ func runCacheServer(ctx context.Context, configFile *string, cacheArgs *cacheSer
|
||||
|
||||
var (
|
||||
dir = cfg.Cache.Dir
|
||||
url = cfg.Cache.AdvertiseUrl
|
||||
host = cfg.Cache.Host
|
||||
port = cfg.Cache.Port
|
||||
)
|
||||
@@ -41,6 +43,9 @@ func runCacheServer(ctx context.Context, configFile *string, cacheArgs *cacheSer
|
||||
if cacheArgs.Dir != "" {
|
||||
dir = cacheArgs.Dir
|
||||
}
|
||||
if cacheArgs.AdvertiseUrl != "" {
|
||||
url = cacheArgs.AdvertiseUrl
|
||||
}
|
||||
if cacheArgs.Host != "" {
|
||||
host = cacheArgs.Host
|
||||
}
|
||||
@@ -50,6 +55,7 @@ func runCacheServer(ctx context.Context, configFile *string, cacheArgs *cacheSer
|
||||
|
||||
cacheHandler, err := artifactcache.StartHandler(
|
||||
dir,
|
||||
url,
|
||||
host,
|
||||
port,
|
||||
log.StandardLogger().WithField("module", "cache_request"),
|
||||
|
||||
@@ -351,7 +351,7 @@ func runExec(ctx context.Context, execArgs *executeArgs) func(cmd *cobra.Command
|
||||
}
|
||||
|
||||
// init a cache server
|
||||
handler, err := artifactcache.StartHandler("", "", 0, log.StandardLogger().WithField("module", "cache_request"))
|
||||
handler, err := artifactcache.StartHandler("", "", "", 0, log.StandardLogger().WithField("module", "cache_request"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ func NewRunner(cfg *config.Config, reg *config.Registration, cli client.Client)
|
||||
} else {
|
||||
cacheHandler, err := artifactcache.StartHandler(
|
||||
cfg.Cache.Dir,
|
||||
cfg.Cache.AdvertiseUrl,
|
||||
cfg.Cache.Host,
|
||||
cfg.Cache.Port,
|
||||
log.StandardLogger().WithField("module", "cache_request"),
|
||||
|
||||
Reference in New Issue
Block a user