Просмотр исходного кода

Updates based on Herman's feedback

Carl Tashian 4 лет назад
Родитель
Сommit
150eee70df
3 измененных файлов с 11 добавлено и 6 удалено
  1. 3 3
      authority/authority.go
  2. 7 3
      ca/ca.go
  3. 1 0
      commands/app.go

+ 3 - 3
authority/authority.go

@@ -80,7 +80,7 @@ type Authority struct {
 	adminMutex sync.RWMutex
 }
 
-type AuthorityInfo struct {
+type Info struct {
 	StartTime          time.Time
 	RootX509Certs      []*x509.Certificate
 	SSHCAUserPublicKey []byte
@@ -567,8 +567,8 @@ func (a *Authority) GetAdminDatabase() admin.DB {
 	return a.adminDB
 }
 
-func (a *Authority) GetInfo() AuthorityInfo {
-	ai := AuthorityInfo{
+func (a *Authority) GetInfo() Info {
+	ai := Info{
 		StartTime:     a.startTime,
 		RootX509Certs: a.rootX509Certs,
 		DNSNames:      a.config.DNSNames,

+ 7 - 3
ca/ca.go

@@ -301,14 +301,18 @@ func (ca *CA) Run() error {
 
 	if !ca.opts.quiet {
 		authorityInfo := ca.auth.GetInfo()
-		log.Printf("Welcome to step-ca.")
+		log.Printf("Starting %s", step.Version())
 		log.Printf("Documentation: https://u.step.sm/docs/ca")
 		log.Printf("Community Discord: https://u.step.sm/discord")
-		log.Printf("Current context: %s", step.Contexts().GetCurrent().Name)
+		if step.Contexts().GetCurrent() != nil {
+			log.Printf("Current context: %s", step.Contexts().GetCurrent().Name)
+		}
 		log.Printf("Config file: %s", ca.opts.configFile)
-		log.Printf("The primary server URL is https://%s%s",
+		baseURL := fmt.Sprintf("https://%s%s",
 			authorityInfo.DNSNames[0],
 			ca.config.Address[strings.LastIndex(ca.config.Address, ":"):])
+		log.Printf("The primary server URL is %s", baseURL)
+		log.Printf("Root certificates are available at %s/roots.pem", baseURL)
 		if len(authorityInfo.DNSNames) > 1 {
 			log.Printf("Additional configured hostnames: %s",
 				strings.Join(authorityInfo.DNSNames[1:], ", "))

+ 1 - 0
commands/app.go

@@ -61,6 +61,7 @@ certificate issuer private key used in the RA mode.`,
 		cli.BoolFlag{
 			Name:  "quiet",
 			Usage: "disable startup information",
+			EnvVar: "STEP_CA_QUIET",
 		},
 		cli.StringFlag{
 			Name:   "context",