-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
29 lines (23 loc) · 681 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main
import (
"os"
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
"github.com/thomas-maurice/pkimanager/cmd"
"github.com/thomas-maurice/pkimanager/config"
)
func main() {
cmd.InitRootCmd()
if err := config.InitConfig(); err != nil {
logrus.WithError(err).Warning("Could not load configuration file")
}
if _, err := os.Stat(viper.GetString("ca_root")); err != nil {
logrus.Infof("Creating directory %s", viper.Get("ca_root"))
if err := os.MkdirAll(viper.GetString("ca_root"), 0750); err != nil {
logrus.Fatalf("Could not create %s: %s", viper.Get("ca_root"), err)
}
}
if err := cmd.RootCmd.Execute(); err != nil {
logrus.Fatal(err)
}
}