mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-12 08:45:38 +02:00
This adds a simple way to incorporate a centralized authentication flow. The idea is to have the user, API and SSH (for machine authentication) all in one place using `openauthjs` + `SST` We also have a database now :) > We are using InstantDB as it allows us to authenticate a use with just the email. Plus it is super simple simple to use _of course after the initial fumbles trying to design the db and relationships_
59 lines
1.3 KiB
Go
59 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"nestrilabs/cli/internal/session"
|
|
|
|
"github.com/charmbracelet/log"
|
|
)
|
|
|
|
func main() {
|
|
// err := cmd.Execute()
|
|
// if err != nil {
|
|
// log.Error("Error running the cmd command", "err", err)
|
|
// }
|
|
|
|
ctx := context.Background()
|
|
|
|
config := &session.SessionConfig{
|
|
Room: "victortest",
|
|
Resolution: "1920x1080",
|
|
Framerate: "60",
|
|
RelayURL: "https://relay.dathorse.com",
|
|
Params: "--verbose=true --video-codec=h264 --video-bitrate=4000 --video-bitrate-max=6000 --gpu-card-path=/dev/dri/card1",
|
|
GamePath: "/path/to/your/game",
|
|
}
|
|
|
|
sess, err := session.NewSession(config)
|
|
if err != nil {
|
|
log.Error("Failed to create session", "err", err)
|
|
}
|
|
|
|
// Start the session
|
|
if err := sess.Start(ctx); err != nil {
|
|
log.Error("Failed to start session", "err", err)
|
|
}
|
|
|
|
// Check if it's running
|
|
if sess.IsRunning() {
|
|
log.Info("Session is running with container ID", "containerId", sess.GetContainerID())
|
|
}
|
|
|
|
env, err := sess.GetEnvironment(ctx)
|
|
if err != nil {
|
|
log.Printf("Failed to get environment: %v", err)
|
|
} else {
|
|
for key, value := range env {
|
|
log.Info("Found this environment variables", key, value)
|
|
}
|
|
}
|
|
|
|
// Let it run for a while
|
|
// time.Sleep(time.Second * 50)
|
|
|
|
// Stop the session
|
|
if err := sess.Stop(ctx); err != nil {
|
|
log.Error("Failed to stop session", "err", err)
|
|
}
|
|
}
|