Merge branch '2411-check-copyright'
[arvados.git] / services / keep-web / main.go
index cd55355c7ca184439c9eb66a86ad3c55f0bf00b2..c4103f409723fbc3c7bbbc3bbd8edcbf7184be42 100644 (file)
@@ -1,14 +1,18 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
 package main
 
 import (
        "flag"
        "log"
        "os"
+       "time"
 
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/config"
        "github.com/coreos/go-systemd/daemon"
-       "github.com/ghodss/yaml"
 )
 
 var (
@@ -25,6 +29,8 @@ type Config struct {
        AttachmentOnlyHost string
        TrustAllContent    bool
 
+       Cache cache
+
        // Hack to support old command line flag, which is a bool
        // meaning "get actual token from environment".
        deprecatedAllowAnonymous bool
@@ -34,6 +40,13 @@ type Config struct {
 func DefaultConfig() *Config {
        return &Config{
                Listen: ":80",
+               Cache: cache{
+                       TTL:                  arvados.Duration(5 * time.Minute),
+                       MaxCollectionEntries: 1000,
+                       MaxCollectionBytes:   100000000,
+                       MaxPermissionEntries: 1000,
+                       MaxUUIDEntries:       1000,
+               },
        }
 }
 
@@ -82,12 +95,7 @@ func main() {
        }
 
        if *dumpConfig {
-               y, err := yaml.Marshal(cfg)
-               if err != nil {
-                       log.Fatal(err)
-               }
-               os.Stdout.Write(y)
-               os.Exit(0)
+               log.Fatal(config.DumpAndExit(cfg))
        }
 
        os.Setenv("ARVADOS_API_HOST", cfg.Client.APIHost)