github.com/aitjcize/Overlord@v0.0.0-20240314041920-104a804cf5e8/cmd/overlordd/main.go (about)

     1  // Copyright 2015 The Chromium OS Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style license that can be
     3  // found in the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	"flag"
     9  	"fmt"
    10  	"os"
    11  
    12  	"github.com/aitjcize/Overlord/overlord"
    13  )
    14  
    15  var bindAddr = flag.String("bind", "0.0.0.0", "specify alternate bind address")
    16  var port = flag.Int("port", 0,
    17  	"alternate port listen instead of standard ports (http:80, https:443)")
    18  var lanDiscInterface = flag.String("lan-disc-iface", "",
    19  	"the network interface used for broadcasting LAN discovery packets")
    20  var noLanDisc = flag.Bool("no-lan-disc", false,
    21  	"disable LAN discovery broadcasting")
    22  var noAuth = flag.Bool("no-auth", false, "disable authentication")
    23  var tlsCerts = flag.String("tls", "",
    24  	"TLS certificates in the form of 'cert.pem,key.pem'. Empty to disable.")
    25  var noLinkTLS = flag.Bool("no-link-tls", false,
    26  	"disable TLS between ghost and overlord. Only valid when TLS is enabled.")
    27  var htpasswdPath = flag.String("htpasswd-path", "app/overlord.htpasswd",
    28  	"the path to the .htpasswd file.")
    29  
    30  func usage() {
    31  	fmt.Fprintf(os.Stderr, "Usage: overlordd [OPTIONS]\n")
    32  	flag.PrintDefaults()
    33  	os.Exit(2)
    34  }
    35  
    36  func main() {
    37  	flag.Usage = usage
    38  	flag.Parse()
    39  
    40  	overlord.StartOverlord(*bindAddr, *port, *lanDiscInterface, !*noLanDisc,
    41  		!*noAuth, *tlsCerts, !*noLinkTLS, *htpasswdPath)
    42  }