Skip to content
Snippets Groups Projects
Select Git revision
  • 87ae7c73ebe05f777e23087b1550d2cab42746ff
  • ballinvoher default protected
  • client-http-server-for-token
  • master
  • gitlab-auth-issue
  • windows
  • microsoft
  • message
  • azure_auth
  • prometheus
  • permission-templates
  • no-datastore
  • save-public-keys
  • gitlab-group-level-start
  • v1.1.0
  • v1.0.0
  • v0.1
17 results

main.go

Blame
    • Niall Sheridan's avatar
      87ae7c73
      Add version string · 87ae7c73
      Niall Sheridan authored
      Add `lib.Version` to get updated at build time.
      Add --version flags to cashier and cashierd
      Send client version in the signing request
      Send server version in http response headers and in signing response
      Set version at build time
      87ae7c73
      History
      Add version string
      Niall Sheridan authored
      Add `lib.Version` to get updated at build time.
      Add --version flags to cashier and cashierd
      Send client version in the signing request
      Send server version in http response headers and in signing response
      Set version at build time
    main.go 877 B
    package main
    
    import (
    	"flag"
    	"fmt"
    	"log"
    	"os"
    
    	"github.com/nsheridan/cashier/lib"
    	"github.com/nsheridan/cashier/server"
    	"github.com/nsheridan/cashier/server/config"
    	"github.com/nsheridan/cashier/server/wkfs/vaultfs"
    	"github.com/nsheridan/wkfs/s3"
    )
    
    var (
    	cfg     = flag.String("config_file", "cashierd.conf", "Path to configuration file.")
    	version = flag.Bool("version", false, "Print version and exit")
    )
    
    func main() {
    	flag.Parse()
    	if *version {
    		fmt.Printf("%s\n", lib.Version)
    		os.Exit(0)
    	}
    	conf, err := config.ReadConfig(*cfg)
    	if err != nil {
    		log.Fatal(err)
    	}
    
    	// Register well-known filesystems.
    	if conf.AWS == nil {
    		conf.AWS = &config.AWS{}
    	}
    	s3.Register(&s3.Options{
    		Region:    conf.AWS.Region,
    		AccessKey: conf.AWS.AccessKey,
    		SecretKey: conf.AWS.SecretKey,
    	})
    	vaultfs.Register(conf.Vault)
    
    	// Start the servers
    	server.Run(conf)
    }