mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 10:21:55 +00:00
feat: Basic to username
This commit is contained in:
@@ -218,7 +218,7 @@ export type RandomString = {
|
||||
len: number
|
||||
}
|
||||
// sometimes the type checker needs just a little bit of help
|
||||
function isValueSpecListOf<S extends ListValueSpecType>(
|
||||
export function isValueSpecListOf<S extends ListValueSpecType>(
|
||||
t: ValueSpec,
|
||||
s: S,
|
||||
): t is ValueSpecListOf<S> & { spec: ListValueSpecOf<S> } {
|
||||
|
||||
@@ -21,7 +21,7 @@ export class NetworkInterfaceBuilder {
|
||||
id: string
|
||||
description: string
|
||||
ui: boolean
|
||||
basic: null | { username: string }
|
||||
username: null | string
|
||||
path: string
|
||||
search: Record<string, string>
|
||||
},
|
||||
@@ -36,10 +36,10 @@ export class NetworkInterfaceBuilder {
|
||||
* @returns
|
||||
*/
|
||||
async export(origins: Iterable<Origin>) {
|
||||
const { name, description, id, ui, basic, path, search } = this.options
|
||||
const { name, description, id, ui, username, path, search } = this.options
|
||||
|
||||
const addresses = Array.from(origins).map((o) =>
|
||||
o.build({ basic, path, search }),
|
||||
o.build({ username, path, search }),
|
||||
)
|
||||
|
||||
await this.options.effects.exportNetworkInterface({
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
export class Origin {
|
||||
constructor(readonly protocol: string | null, readonly host: string) {}
|
||||
|
||||
build({ basic, path, search }: BuildOptions) {
|
||||
build({ username, path, search }: BuildOptions) {
|
||||
// prettier-ignore
|
||||
const urlAuth = !!(basic) ? `${basic.username}@` :
|
||||
const urlAuth = !!(username) ? `${username}@` :
|
||||
'';
|
||||
const protocolSection = this.protocol != null ? `${this.protocol}://` : ""
|
||||
|
||||
@@ -20,7 +20,7 @@ export class Origin {
|
||||
}
|
||||
|
||||
type BuildOptions = {
|
||||
basic: { username: string } | null
|
||||
username: string | null
|
||||
path: string
|
||||
search: Record<string, string>
|
||||
}
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { ListValueSpecOf, isValueSpecListOf } from "../config/configTypes"
|
||||
import {
|
||||
ListValueSpecOf,
|
||||
ValueSpec,
|
||||
isValueSpecListOf,
|
||||
} from "../config/configTypes"
|
||||
import { Config } from "../config/builder/config"
|
||||
import { List } from "../config/builder/list"
|
||||
import { Value } from "../config/builder/value"
|
||||
|
||||
Reference in New Issue
Block a user