Documentation ¶
Overview ¶
Package profile is for specific profiles @todo this package is the definition of cruft and should be rewritten in a more elegant way
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Client = &Profile{ Name: "client", Setup: func(ctx *cli.Context) error { return nil }, }
Client profile is for any entrypoint that behaves as a client
View Source
var Local = &Profile{ Name: "local", Setup: func(ctx *cli.Context) error { client.DefaultClient = grpcClient.NewClient() server.DefaultServer = grpcServer.NewServer() microAuth.DefaultAuth = jwt.NewAuth() microStore.DefaultStore = file.NewStore(file.WithDir(filepath.Join(user.Dir, "server", "store"))) SetupConfigSecretKey(ctx) config.DefaultConfig, _ = storeConfig.NewConfig(microStore.DefaultStore, "") SetupJWT(ctx) SetupRegistry(memory.NewRegistry()) SetupBroker(memBroker.NewBroker()) model.DefaultModel = model.NewModel( model.WithStore(microStore.DefaultStore), ) microRuntime.DefaultRuntime = local.NewRuntime() var err error microEvents.DefaultStream, err = memStream.NewStream() if err != nil { logger.Fatalf("Error configuring stream: %v", err) } microEvents.DefaultStore = evStore.NewStore( evStore.WithStore(microStore.DefaultStore), ) microStore.DefaultBlobStore, err = file.NewBlobStore() if err != nil { logger.Fatalf("Error configuring file blob store: %v", err) } return nil }, }
Local profile to run as a single process
View Source
var Server = &Profile{ Name: "server", Setup: func(ctx *cli.Context) error { microAuth.DefaultAuth = jwt.NewAuth() microStore.DefaultStore = file.NewStore(file.WithDir(filepath.Join(user.Dir, "server", "store"))) SetupConfigSecretKey(ctx) config.DefaultConfig, _ = storeConfig.NewConfig(microStore.DefaultStore, "") SetupJWT(ctx) if ctx.Args().Get(1) == "registry" { SetupRegistry(memory.NewRegistry()) } else { registry.DefaultRegistry.Init( registry.Addrs("localhost:8000"), ) SetupRegistry(registry.DefaultRegistry) } if ctx.Args().Get(1) == "broker" { SetupBroker(memBroker.NewBroker()) } else { broker.DefaultBroker.Init( broker.Addrs("localhost:8003"), ) SetupBroker(broker.DefaultBroker) } model.DefaultModel = model.NewModel( model.WithStore(microStore.DefaultStore), ) microRuntime.DefaultRuntime = local.NewRuntime() var err error microEvents.DefaultStream, err = memStream.NewStream() if err != nil { logger.Fatalf("Error configuring stream: %v", err) } microEvents.DefaultStore = evStore.NewStore( evStore.WithStore(microStore.DefaultStore), ) microStore.DefaultBlobStore, err = file.NewBlobStore() if err != nil { logger.Fatalf("Error configuring file blob store: %v", err) } return nil }, }
View Source
var Service = &Profile{ Name: "service", Setup: func(ctx *cli.Context) error { return nil }, }
Service is the default for any services run
View Source
var Test = &Profile{ Name: "test", Setup: func(ctx *cli.Context) error { microAuth.DefaultAuth = noop.NewAuth() microStore.DefaultStore = mem.NewStore() microStore.DefaultBlobStore, _ = file.NewBlobStore() config.DefaultConfig, _ = storeConfig.NewConfig(microStore.DefaultStore, "") SetupRegistry(memory.NewRegistry()) model.DefaultModel = model.NewModel( model.WithStore(microStore.DefaultStore), ) return nil }, }
Test profile is used for the go test suite
Functions ¶
func SetupConfigSecretKey ¶
func SetupConfigSecretKey(ctx *cli.Context)
func SetupJWT ¶
func SetupJWT(ctx *cli.Context)
SetupJWT configures the default internal system rules
func SetupRegistry ¶
SetupRegistry configures the registry
Types ¶
Click to show internal directories.
Click to hide internal directories.