@decaf-ts/fabric-weaver
Version:
template for ts projects
60 lines (59 loc) • 3.03 kB
TypeScript
import { Logger } from "@decaf-ts/logging";
import { BCCSPConfig, ChaincodeConfig, DeliveryClientConfig, DiscoveryConfig, GatewayConfig, GeneralConfig, GossipConfig, HandlersConfig, KeepAliveConfig, LedgerStateConfig, LimitsConfig, MSGSizeConfig, MSPConfig, PrivateDataStoreConfig, ProfileConfig, TLSConfig, VMConfig } from "../interfaces/fabric/peer-config";
import { MetricsConfig, OperationsConfig } from "../interfaces/fabric/general-configs";
export declare class FabricPeerConfigBuilder {
private log;
private config;
constructor(logger?: Logger);
setGossip(gossip?: GossipConfig): this;
setTLS(tls?: TLSConfig): this;
setAuthentication(authentication?: string): this;
setKeepAlice(keepAlice?: KeepAliveConfig): this;
setGateway(gateway?: GatewayConfig): this;
setGeneral(general?: GeneralConfig): this;
setBCCSP(bccsp?: BCCSPConfig): this;
setMspConfig(mspConfig?: MSPConfig): this;
setConnTimeoutClient(connTimeoutClient?: string): this;
setDeliveryClient(deliveryClient?: DeliveryClientConfig): this;
setProfile(profile?: ProfileConfig): this;
setHandlers(handlers?: HandlersConfig): this;
setDiscovery(discovery?: DiscoveryConfig): this;
setLimits(limits?: LimitsConfig): this;
setMessageSize(size?: MSGSizeConfig): this;
setChaincode(chaincode?: ChaincodeConfig): this;
setVMOptions(options?: VMConfig): this;
setLedgerState(state?: LedgerStateConfig): this;
setLegerBlockchain(blockchain?: any): this;
enableLedgerHistoryDatabase(enable?: boolean): this;
setLedgerPvtDataStore(pvtData?: PrivateDataStoreConfig): this;
setLedgerSnapshotsRootDir(rootDir?: string): this;
setOperations(operations?: OperationsConfig): this;
setMetrics(metrics?: MetricsConfig): this;
/**
* @description Saves the current configuration to a file.
* @summary Writes the current Fabric CA Server configuration to a YAML file at the specified path. If the directory doesn't exist, it will be created.
* @param {string} cpath - The path where the configuration file should be saved.
* @return {this} The current instance of the builder for method chaining.
* @example
* const builder = new FabricCAServerCommandBuilder();
* builder.save('/path/to/config/fabric-ca-server.yaml');
*
* @mermaid
* sequenceDiagram
* participant Client
* participant Builder as FabricCAServerCommandBuilder
* participant FileSystem as File System
* Client->>Builder: saveConfig('/path/to/config/fabric-ca-server.yaml')
* Builder->>Builder: Check if cpath is defined
* alt cpath is defined
* Builder->>FileSystem: Check if directory exists
* alt Directory doesn't exist
* Builder->>FileSystem: Create directory
* end
* Builder->>Builder: Log debug message
* Builder->>FileSystem: Write YAML configuration to file
* end
* Builder-->>Client: Return this
*/
save(cpath?: string): this;
}