You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.0 KiB

import {TypeTag, JSONState, isJSON} from '@extollo/lib'
import * as IPCIDR from 'ip-cidr'
export type IpAddress = TypeTag<'p5x.ip.address'> & string
export const isIpAddress = (what: unknown): what is IpAddress =>
typeof what === 'string' && IPCIDR.isValidAddress(what)
export type Subnet = TypeTag<'p5x.ip.subnet'> & number
export const isSubnet = (what: unknown): what is Subnet =>
typeof what === 'number' && IPCIDR.isValidCIDR(`1.1.1.1/${what}`)
export type JSONString = TypeTag<'p5x.json'> & string
export const isJSONString = (what: unknown): what is JSONString =>
typeof what === 'string' && isJSON(what)
export type Settings = Record<string, JSONState> & {
pveMasterNode: string
pveApiHost: string
pveStoragePool: string
// pveTokenId: string
// pveTokenSecret: string
pveRootPassword: string
lxcTemplateFileName: string
rootPassword: string
sshPublicKey: string
sshPrivateKey: string
dnsDomain: string
nodeNetworkBridge: string
nodeCpus: number
nodeRamMib: number
}