MCPcopy Index your code
hub / github.com/opencloud-eu/opencloud / Server

Function Server

services/proxy/pkg/command/server.go:53–244  ·  view source on GitHub ↗

Server is the entrypoint for the server command.

(cfg *config.Config)

Source from the content-addressed store, hash-verified

51
52// Server is the entrypoint for the server command.
53func Server(cfg *config.Config) *cobra.Command {
54 return &cobra.Command{
55 Use: "server",
56 Short: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name),
57 PreRunE: func(cmd *cobra.Command, args []string) error {
58 return configlog.ReturnFatal(parser.ParseConfig(cfg))
59 },
60 RunE: func(cmd *cobra.Command, args []string) error {
61 userInfoCache := store.Create(
62 store.Store(cfg.OIDC.UserinfoCache.Store),
63 store.TTL(cfg.OIDC.UserinfoCache.TTL),
64 microstore.Nodes(cfg.OIDC.UserinfoCache.Nodes...),
65 microstore.Database(cfg.OIDC.UserinfoCache.Database),
66 microstore.Table(cfg.OIDC.UserinfoCache.Table),
67 store.DisablePersistence(cfg.OIDC.UserinfoCache.DisablePersistence),
68 store.Authentication(cfg.OIDC.UserinfoCache.AuthUsername, cfg.OIDC.UserinfoCache.AuthPassword),
69 store.TLSEnabled(cfg.OIDC.UserinfoCache.EnableTLS),
70 store.TLSInsecure(cfg.OIDC.UserinfoCache.TLSInsecure),
71 store.TLSRootCA(cfg.OIDC.UserinfoCache.TLSRootCACertificate),
72 )
73
74 signingKeyStore := store.Create(
75 store.Store(cfg.PreSignedURL.SigningKeys.Store),
76 store.TTL(cfg.PreSignedURL.SigningKeys.TTL),
77 microstore.Nodes(cfg.PreSignedURL.SigningKeys.Nodes...),
78 microstore.Database("proxy"),
79 microstore.Table("signing-keys"),
80 store.DisablePersistence(cfg.PreSignedURL.SigningKeys.DisablePersistence),
81 store.Authentication(cfg.PreSignedURL.SigningKeys.AuthUsername, cfg.PreSignedURL.SigningKeys.AuthPassword),
82 store.TLSEnabled(cfg.PreSignedURL.SigningKeys.EnableTLS),
83 store.TLSInsecure(cfg.PreSignedURL.SigningKeys.TLSInsecure),
84 store.TLSRootCA(cfg.PreSignedURL.SigningKeys.TLSRootCACertificate),
85 )
86
87 logger := log.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel)
88 traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name)
89 if err != nil {
90 return err
91 }
92 cfg.GrpcClient, err = grpc.NewClient(
93 append(
94 grpc.GetClientOptions(cfg.GRPCClientTLS),
95 grpc.WithTraceProvider(traceProvider))...)
96 if err != nil {
97 return err
98 }
99
100 oidcHTTPClient := &http.Client{
101 Transport: &http.Transport{
102 TLSClientConfig: &tls.Config{
103 MinVersion: tls.VersionTLS12,
104 InsecureSkipVerify: cfg.OIDC.Insecure, //nolint:gosec
105 },
106 DisableKeepAlives: true,
107 },
108 Timeout: time.Second * 10,
109 }
110

Callers 1

GetCommandsFunction · 0.70

Calls 15

HandlerMethod · 0.95
ReturnFatalFunction · 0.92
ParseConfigFunction · 0.92
ConfigureFunction · 0.92
GetTraceProviderFunction · 0.92
NewClientFunction · 0.92
GetClientOptionsFunction · 0.92
WithTraceProviderFunction · 0.92
NewOIDCClientFunction · 0.92
WithLoggerFunction · 0.92
WithHTTPClientFunction · 0.92

Tested by

no test coverage detected