capt: remove heavy client naming (#790)

This commit is contained in:
JT Olio 2018-12-07 08:36:09 -07:00 committed by GitHub
parent 7d8c92473a
commit 9a06de0407
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,10 +19,10 @@ import (
// Config defines broad Captain Planet configuration // Config defines broad Captain Planet configuration
type Config struct { type Config struct {
HCCA provider.CASetupConfig SatelliteCA provider.CASetupConfig
HCIdentity provider.IdentitySetupConfig SatelliteIdentity provider.IdentitySetupConfig
ULCA provider.CASetupConfig UplinkCA provider.CASetupConfig
ULIdentity provider.IdentitySetupConfig UplinkIdentity provider.IdentitySetupConfig
StorageNodeCA provider.CASetupConfig StorageNodeCA provider.CASetupConfig
StorageNodeIdentity provider.IdentitySetupConfig StorageNodeIdentity provider.IdentitySetupConfig
BasePath string `help:"base path for captain planet storage" default:"$CONFDIR"` BasePath string `help:"base path for captain planet storage" default:"$CONFDIR"`
@ -68,17 +68,17 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) {
} }
} }
hcPath := filepath.Join(setupCfg.BasePath, "satellite") satellitePath := filepath.Join(setupCfg.BasePath, "satellite")
err = os.MkdirAll(hcPath, 0700) err = os.MkdirAll(satellitePath, 0700)
if err != nil { if err != nil {
return err return err
} }
setupCfg.HCCA.CertPath = filepath.Join(hcPath, "ca.cert") setupCfg.SatelliteCA.CertPath = filepath.Join(satellitePath, "ca.cert")
setupCfg.HCCA.KeyPath = filepath.Join(hcPath, "ca.key") setupCfg.SatelliteCA.KeyPath = filepath.Join(satellitePath, "ca.key")
setupCfg.HCIdentity.CertPath = filepath.Join(hcPath, "identity.cert") setupCfg.SatelliteIdentity.CertPath = filepath.Join(satellitePath, "identity.cert")
setupCfg.HCIdentity.KeyPath = filepath.Join(hcPath, "identity.key") setupCfg.SatelliteIdentity.KeyPath = filepath.Join(satellitePath, "identity.key")
fmt.Printf("creating identity for satellite\n") fmt.Printf("creating identity for satellite\n")
err = provider.SetupIdentity(process.Ctx(cmd), setupCfg.HCCA, setupCfg.HCIdentity) err = provider.SetupIdentity(process.Ctx(cmd), setupCfg.SatelliteCA, setupCfg.SatelliteIdentity)
if err != nil { if err != nil {
return err return err
} }
@ -107,12 +107,12 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) {
if err != nil { if err != nil {
return err return err
} }
setupCfg.ULCA.CertPath = filepath.Join(uplinkPath, "ca.cert") setupCfg.UplinkCA.CertPath = filepath.Join(uplinkPath, "ca.cert")
setupCfg.ULCA.KeyPath = filepath.Join(uplinkPath, "ca.key") setupCfg.UplinkCA.KeyPath = filepath.Join(uplinkPath, "ca.key")
setupCfg.ULIdentity.CertPath = filepath.Join(uplinkPath, "identity.cert") setupCfg.UplinkIdentity.CertPath = filepath.Join(uplinkPath, "identity.cert")
setupCfg.ULIdentity.KeyPath = filepath.Join(uplinkPath, "identity.key") setupCfg.UplinkIdentity.KeyPath = filepath.Join(uplinkPath, "identity.key")
fmt.Printf("creating identity for uplink\n") fmt.Printf("creating identity for uplink\n")
err = provider.SetupIdentity(process.Ctx(cmd), setupCfg.ULCA, setupCfg.ULIdentity) err = provider.SetupIdentity(process.Ctx(cmd), setupCfg.UplinkCA, setupCfg.UplinkIdentity)
if err != nil { if err != nil {
return err return err
} }
@ -122,10 +122,10 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) {
if err := os.MkdirAll(minioCertsPath, 0744); err != nil { if err := os.MkdirAll(minioCertsPath, 0744); err != nil {
return err return err
} }
if err := os.Link(setupCfg.ULIdentity.CertPath, filepath.Join(minioCertsPath, "public.crt")); err != nil { if err := os.Link(setupCfg.UplinkIdentity.CertPath, filepath.Join(minioCertsPath, "public.crt")); err != nil {
return err return err
} }
if err := os.Link(setupCfg.ULIdentity.KeyPath, filepath.Join(minioCertsPath, "private.key")); err != nil { if err := os.Link(setupCfg.UplinkIdentity.KeyPath, filepath.Join(minioCertsPath, "private.key")); err != nil {
return err return err
} }
} }
@ -135,8 +135,8 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) {
overlayAddr := joinHostPort(setupCfg.ListenHost, startingPort+1) overlayAddr := joinHostPort(setupCfg.ListenHost, startingPort+1)
overrides := map[string]interface{}{ overrides := map[string]interface{}{
"satellite.identity.cert-path": setupCfg.HCIdentity.CertPath, "satellite.identity.cert-path": setupCfg.SatelliteIdentity.CertPath,
"satellite.identity.key-path": setupCfg.HCIdentity.KeyPath, "satellite.identity.key-path": setupCfg.SatelliteIdentity.KeyPath,
"satellite.identity.server.address": joinHostPort( "satellite.identity.server.address": joinHostPort(
setupCfg.ListenHost, startingPort+1), setupCfg.ListenHost, startingPort+1),
"satellite.kademlia.bootstrap-addr": joinHostPort( "satellite.kademlia.bootstrap-addr": joinHostPort(
@ -150,8 +150,8 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) {
"satellite.repairer.pointer-db-addr": joinHostPort( "satellite.repairer.pointer-db-addr": joinHostPort(
setupCfg.ListenHost, startingPort+1), setupCfg.ListenHost, startingPort+1),
"satellite.repairer.api-key": setupCfg.APIKey, "satellite.repairer.api-key": setupCfg.APIKey,
"uplink.identity.cert-path": setupCfg.ULIdentity.CertPath, "uplink.identity.cert-path": setupCfg.UplinkIdentity.CertPath,
"uplink.identity.key-path": setupCfg.ULIdentity.KeyPath, "uplink.identity.key-path": setupCfg.UplinkIdentity.KeyPath,
"uplink.identity.address": joinHostPort( "uplink.identity.address": joinHostPort(
setupCfg.ListenHost, startingPort), setupCfg.ListenHost, startingPort),
"uplink.client.overlay-addr": joinHostPort( "uplink.client.overlay-addr": joinHostPort(