Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fakeseamconnect to server selection #88

Merged
merged 5 commits into from
Feb 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions lib/interact-for-server-selection.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import prompts from "prompts"
import { getConfigStore } from "./get-config-store"
import { randomBytes } from "node:crypto"
import { getServer } from "./get-server"

export async function interactForServerSelection() {
const servers = ["http://localhost:3020", "https://connect.getseam.com"]
const servers = [
"http://localhost:3020",
"https://connect.getseam.com",
"https://fakeseamconnect.seam.vc",
]

const { server } = await prompts([
{
Expand All @@ -14,7 +20,25 @@ export async function interactForServerSelection() {
])

const config = getConfigStore()
config.set("server", server)
if (server === servers[2]) {
let { userUrlSeed } = await prompts([
{
type: "text",
name: "userUrlSeed",
message:
"You can input a custom server URL or leave this field empty to use a new fakeserver.",
},
])

if (userUrlSeed.trim().length === 0) {
userUrlSeed = randomBytes(5).toString("hex")
}
config.set("server", `https://${userUrlSeed}.fakeseamconnect.seam.vc`)
config.set(`${getServer()}.pat`, `seam_apikey1_token`)
console.log(`PAT set to use fakeseamconnect with "seam_apikey1_token"`)
} else {
config.set("server", server)
}
config.delete("current_workspace_id")
console.log(`Server set to ${server}`)
}
Loading