Replies: 3 comments 2 replies
-
There are unfortunately no plans to support that as there is really a lot of bootstrapping required. Also, we do not want to maintain API compatibility for internal APIs as it is a lot of unnecessary work and the gained benefit is small! |
Beta Was this translation helpful? Give feedback.
-
I like the idea of importing the cobra commands and running them directly within go, similar to https://github.com/ory/keto/blob/fe92134db8c22b6c7c2b11397d8c1dc0e36c12ae/internal/e2e/cli_client_test.go This would look similar to func main() {
l := myLogrusLogger()
ctx := kratos.WithLogger(context.Background(), l)
ctx = kratos.WithConfigValue(ctx, "public.serve.port", 0)
k := kratos.RootCommand()
k.SetArgs([]string{"serve", "-c", myConfigPath)
k.ExecuteContext(ctx)
} See https://github.com/ory/x/blob/0b4ae5055bc414c834728232b3cfbfb07b7c1d10/cmdx/helper.go#L129-L147 for more examples on how cobra commands can be set up and run programmatically. |
Beta Was this translation helpful? Give feedback.
-
Also quick note. What about exposing API without a compatibility guarantee. From what I've checked the bootstrapping is not that hard as it is mainly create a driver in serve/root.go and then a bit setup in serve.go. The I'm not saying about allowing some crazy integration like choosing a Postgres driver, logging lib etc. Just move HTTP handler creation to separate function and that's it (without guarantee, nothing). Use it at your own risk. |
Beta Was this translation helpful? Give feedback.
-
Hi,
It would be great to be able to mount Kratos
http.Handler
inside app without setting up a microservice.Beta Was this translation helpful? Give feedback.
All reactions