Skip to content

Commit

Permalink
* more work on name conversion TEM --> POP (or TAPIR-POP).
Browse files Browse the repository at this point in the history
  • Loading branch information
johanix committed Aug 29, 2024
1 parent 321fed9 commit d06b490
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions apihandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ func SetupRouter(conf *Config) *mux.Router {

sr := r.PathPrefix("/api/v1").Headers("X-API-Key",
viper.GetString("apiserver.key")).Subrouter()
sr.HandleFunc("/ping", tapir.APIping("tem", conf.BootTime)).Methods("POST")
sr.HandleFunc("/ping", tapir.APIping("tapir-pop", conf.BootTime)).Methods("POST")
sr.HandleFunc("/command", APIcommand(conf)).Methods("POST")
sr.HandleFunc("/bootstrap", APIbootstrap(conf)).Methods("POST")
sr.HandleFunc("/debug", APIdebug(conf)).Methods("POST")
Expand All @@ -497,7 +497,7 @@ func SetupBootstrapRouter(conf *Config) *mux.Router {
r := mux.NewRouter().StrictSlash(true)

sr := r.PathPrefix("/api/v1").Headers("X-API-Key", viper.GetString("apiserver.key")).Subrouter()
sr.HandleFunc("/ping", tapir.APIping("tem", conf.BootTime)).Methods("POST")
sr.HandleFunc("/ping", tapir.APIping("tapir-pop", conf.BootTime)).Methods("POST")
sr.HandleFunc("/bootstrap", APIbootstrap(conf)).Methods("POST")
// sr.HandleFunc("/debug", APIdebug(conf)).Methods("POST")
// sr.HandleFunc("/show/api", tapir.APIshowAPI(r)).Methods("GET")
Expand Down Expand Up @@ -533,8 +533,14 @@ func APIhandler(conf *Config, done <-chan struct{}) {

addresses := viper.GetStringSlice("apiserver.addresses")
tlsaddresses := viper.GetStringSlice("apiserver.tlsaddresses")
certfile := viper.GetString("certs.tem.cert")
keyfile := viper.GetString("certs.tem.key")
certfile := viper.GetString("certs.tapir-pop.cert")
if certfile == "" {
log.Printf("*** APIhandler: Error: TLS cert file not specified under key certs.tapir-pop.cert")
}
keyfile := viper.GetString("certs.tapir-pop.key")
if keyfile == "" {
log.Printf("*** APIhandler: Error: TLS key file not specified under key certs.tapir-pop.key")
}

bootstrapaddresses := viper.GetStringSlice("bootstrapserver.addresses")
bootstraptlsaddresses := viper.GetStringSlice("bootstrapserver.tlsaddresses")
Expand All @@ -547,10 +553,12 @@ func APIhandler(conf *Config, done <-chan struct{}) {

_, err := os.Stat(certfile)
if os.IsNotExist(err) {
log.Printf("*** APIhandler: Error: TLS cert file \"%s\" does not exist", certfile)
tlspossible = false
}
_, err = os.Stat(keyfile)
if os.IsNotExist(err) {
log.Printf("*** APIhandler: Error: TLS key file \"%s\" does not exist", keyfile)
tlspossible = false
}

Expand Down
2 changes: 1 addition & 1 deletion bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (td *TemData) BootstrapMqttSource(s *tapir.WBGlist, src SourceConf) (*tapir
TEMExiter("BootstrapMqttSource error: missing config key: certs.certdir")
}
// cert := cd + "/" + certname
cert := cd + "/" + "tem"
cert := cd + "/" + "tapir-pop"
tlsConfig, err := tapir.NewClientConfig(viper.GetString("certs.cacertfile"), cert+".key", cert+".crt")
if err != nil {
TEMExiter("BootstrapMqttSource: Error: Could not set up TLS: %v", err)
Expand Down

0 comments on commit d06b490

Please sign in to comment.