Documentation ¶
Overview ¶
Package server provides the server subcommand.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = &cobra.Command{ Use: "server", Short: "Start the RUN-DSP server", Long: `Starts the RUN-DSP connector, which then connects to the provider and will start serving dataspace requests`, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { _, err := url.Parse(viper.GetString("server.dsp.externalURL")) if err != nil { return fmt.Errorf("Invalid external URL: %w", err) } err = cfg.CheckListenPort(viper.GetString("server.dsp.address"), viper.GetInt("server.dsp.port")) if err != nil { return err } err = cfg.CheckConnectAddr(viper.GetString("server.provider.address")) if err != nil { return err } if !viper.GetBool("server.provider.insecure") { err = cfg.CheckFilesExist( viper.GetString("server.provider.caCert"), viper.GetString("server.provider.clientCert"), viper.GetString("server.provider.clientCertKey"), ) if err != nil { return err } } if viper.GetBool("server.control.enabled") { err = cfg.CheckListenPort(viper.GetString("server.control.address"), viper.GetInt("server.control.port")) if err != nil { return err } if !viper.GetBool("server.control.insecure") { err = cfg.CheckFilesExist( viper.GetString("server.control.cert"), viper.GetString("server.control.certKey"), ) if err != nil { return err } if viper.GetBool("server.control.verifyClientCerts") { err = cfg.CheckFilesExist(viper.GetString("server.control.clientCACert")) if err != nil { return err } } } } return nil }, RunE: func(cmd *cobra.Command, args []string) error { u, err := url.Parse(viper.GetString("server.dsp.externalURL")) if err != nil { panic(err.Error()) } c := command{ ListenAddr: viper.GetString("server.dsp.address"), Port: viper.GetInt("server.dsp.port"), ExternalURL: u, ProviderAddress: viper.GetString("server.provider.address"), ProviderInsecure: viper.GetBool("server.provider.insecure"), ProviderCACert: viper.GetString("server.provider.caCert"), ProviderClientCert: viper.GetString("server.provider.clientCert"), ProviderClientCertKey: viper.GetString("server.provider.clientCert"), ControlEnabled: viper.GetBool("server.control.enabled"), ControlListenAddr: viper.GetString("server.control.address"), ControlPort: viper.GetInt("server.control.port"), ControlInsecure: viper.GetBool("server.control.insecure"), ControlCert: viper.GetString("server.control.cert"), ControlCertKey: viper.GetString("server.control.certKey"), ControlVerifyClientCertificates: viper.GetBool("server.control.verifyClientCerts"), ControlClientCACert: viper.GetString("server.control.clientCACert"), } ctx, ok := viper.Get("initCTX").(context.Context) if !ok { return fmt.Errorf("couldn't fetch initial context") } return c.Run(ctx) }, }
Command validates the configuration and then runs the server.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.