allow client to be specified as arg
This commit is contained in:
parent
c425f6cc51
commit
504fe3ccee
1 changed files with 17 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using Godot;
|
using Godot;
|
||||||
using SpacetimeDB;
|
using SpacetimeDB;
|
||||||
using SpacetimeDB.Types;
|
using SpacetimeDB.Types;
|
||||||
|
|
@ -33,10 +34,25 @@ public class Spacetime
|
||||||
|
|
||||||
private static Spacetime _instance;
|
private static Spacetime _instance;
|
||||||
|
|
||||||
|
string GetClientArg()
|
||||||
|
{
|
||||||
|
foreach (string arg in OS.GetCmdlineUserArgs())
|
||||||
|
{
|
||||||
|
GD.Print(arg);
|
||||||
|
if (new Regex("--client=.+").IsMatch(arg))
|
||||||
|
{
|
||||||
|
return arg.Split("=")[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public Spacetime(string host, string dbName)
|
public Spacetime(string host, string dbName)
|
||||||
{
|
{
|
||||||
|
string client = GetClientArg() ?? "massive";
|
||||||
|
|
||||||
// Initialize the `AuthToken` module
|
// Initialize the `AuthToken` module
|
||||||
AuthToken.Init(".spacetime_csharp_quickstart");
|
AuthToken.Init($".spacetime/{client}");
|
||||||
|
|
||||||
Connection = DbConnection
|
Connection = DbConnection
|
||||||
.Builder()
|
.Builder()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue