github.com/google/trillian-examples@v0.0.0-20240520080811-0d40d35cef0e/binary_transparency/firmware/cmd/ftmapserver/ftmapserver.go (about)

     1  // Copyright 2021 Google LLC. All Rights Reserved.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // This package is the entrypoint for the Firmware Transparency map server.
    16  // This requires a Trillian instance to be reachable via gRPC and a tree to have
    17  // been provisioned. See the README in the root of this project for instructions.
    18  package main
    19  
    20  import (
    21  	"context"
    22  	"flag"
    23  
    24  	"github.com/golang/glog"
    25  	"github.com/google/trillian-examples/binary_transparency/firmware/cmd/ftmapserver/impl"
    26  )
    27  
    28  var (
    29  	listenAddr = flag.String("listen", ":8001", "address:port to listen for requests on")
    30  	mapDBAddr  = flag.String("map_db", "", "Connection path for map database")
    31  )
    32  
    33  func main() {
    34  	flag.Parse()
    35  
    36  	ctx := context.Background()
    37  	if err := impl.Main(ctx, impl.MapServerOpts{
    38  		ListenAddr: *listenAddr,
    39  		MapDBAddr:  *mapDBAddr,
    40  	}); err != nil {
    41  		glog.Exit(err.Error())
    42  	}
    43  }