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 & { 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 }