summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-03-28 21:40:05 -0600
committermo khan <mo@mokhan.ca>2025-03-28 21:40:05 -0600
commitf7065e0b4de97cbafcb732c459f8744d2f5c55e5 (patch)
tree33fb5acef59d3ee931ad80e1cfa6d836dc7dd328
parent9d4cc3d2de47769d287b254c39e3f66c23e403ab (diff)
chore: extract magefiles directory
-rw-r--r--magefiles/magefile.go (renamed from magefile.go)29
1 files changed, 28 insertions, 1 deletions
diff --git a/magefile.go b/magefiles/magefile.go
index 4ce8e00..5f5c0ff 100644
--- a/magefile.go
+++ b/magefiles/magefile.go
@@ -5,6 +5,7 @@ package main
import (
"context"
+ "os"
"path/filepath"
"github.com/magefile/mage/mg"
@@ -63,6 +64,32 @@ func Authzd() error {
return sh.RunWithV(env, "go", "run", "./cmd/authzd/main.go")
}
+// Start NATS server
+func Nats() error {
+ return sh.RunV(
+ "nats-server",
+ "--addr=127.0.0.1",
+ "--port=4222",
+ "--http_port=8222",
+ "--pid=tmp/pids/nats.pid",
+ "--jetstream",
+ "--store_dir=tmp/nats/store",
+ )
+}
+
+// Start CA
+func CertificateAuthority() error {
+ env := map[string]string{
+ "STEPPATH": filepath.Join(x.Must(os.Getwd()), "/tmp/step"),
+ }
+ return sh.RunWithV(
+ env,
+ "step-ca",
+ "$STEPPATH/config/ca.json",
+ "--password-file=$STEPPATH/password.txt",
+ )
+}
+
// Generate gRPC from protocal buffers
func Protos() error {
for _, file := range x.Must(filepath.Glob("./protos/*.proto")) {
@@ -86,7 +113,7 @@ func Protos() error {
// Run All the servers
func Servers(ctx context.Context) {
- mg.CtxDeps(ctx, Idp, UI, Api, Authzd, Gateway)
+ mg.CtxDeps(ctx, CertificateAuthority, Nats, Idp, UI, Api, Authzd, CertificateAuthority, Gateway)
}
// Run the end to end tests