https://www.ory.sh/ logo
#general
Title
# general
m

magnificent-autumn-87338

11/24/2021, 5:09 PM
Hi! 👋 I was wondering if there's a way to import the Go packages from
<http://github.com/ory/kratos|github.com/ory/kratos>
and
<http://github.com/ory/keto|github.com/ory/keto>
that live under
internal/
in your own Go project. E.g. to leverage the low-level behavior from the internal packages but without running Kratos and Keto standalone. (Please ignore for a moment the very valid question/argument of why you would even want to do such a thing).
s

steep-lamp-91158

11/24/2021, 5:12 PM
I guess you have to work with a fork, as go itself does not let you import those
but why would you even want to do such a thing? 😜
😂 3
m

magnificent-autumn-87338

11/24/2021, 5:15 PM
I could see myself building a (micro) SaaS, leveraging the various projects from the Ory ecosystem, but (initially) avoid the mental/operational overhead (even though pretty minimal) of running separate services for auth-z.
s

steep-lamp-91158

11/24/2021, 5:16 PM
hm I see, so you want to bundle them as one binary?
m

magnificent-autumn-87338

11/24/2021, 5:16 PM
Another use case would be to use a custom storage backend (e.g. for Spanner or DynamoDB) -- but maybe this is possible already?
hm I see, so you want to bundle them as one binary?
Yes. As a dev it would be pretty sweet if I can take all the sweetness of Ory (e.g. OIDC, crypto best practices, Google Zanzibar implementation) but without the RPC/ transport side
s

steep-lamp-91158

11/24/2021, 5:21 PM
I recommend you import the commands instead, it is 💯 % possible to run keto (and I think also kratos) from within go: https://gist.github.com/zepatrik/8616cc59843fd8f4ad88a3fe1e7078b3
but that still starts a server and you need to interface through http
problem is: we don't have internal API stability, and we will probably never have that
m

magnificent-autumn-87338

11/24/2021, 5:23 PM
Yeah; I figured that's the reason they're
internal
in the first place
s

steep-lamp-91158

11/24/2021, 5:23 PM
exactly
m

magnificent-autumn-87338

11/24/2021, 5:23 PM
Would be cool if (eventually) the API stabilizes even more to make them non-internal, or separate Go modules perhaps?
s

steep-lamp-91158

11/24/2021, 5:24 PM
we could at some point expose public functions that talk to the internal API, but only provide high level capabilities similar to the APIs
💡 1
m

magnificent-autumn-87338

11/24/2021, 5:24 PM
Similar to how Caddy for instance imports CertMagic, but you can also import and use CertMagic embedded in your own Go projects for automatic TLS management
s

steep-lamp-91158

11/24/2021, 5:25 PM
it will never be feasable to expose all internal details IMO
but some go interface makes sense at some point
not in the near future IMO though
👍 1
m

magnificent-autumn-87338

11/24/2021, 5:27 PM
Thanks for the quick response and elaborating/exploring! 🙏
2 Views