Ejemplo n.º 1
0
func createConfigFile(xmppJID, robotRefreshToken, userRefreshToken, shareScope, proxy string) {
	config := lib.Config{
		xmppJID,
		robotRefreshToken,
		userRefreshToken,
		shareScope,
		proxy,
		flagToUint(gcpMaxConcurrentDownloadsFlag, lib.DefaultConfig.GCPMaxConcurrentDownloads),
		flagToUint(cupsMaxConnectionsFlag, lib.DefaultConfig.CUPSMaxConnections),
		flagToDurationString(cupsConnectTimeoutFlag, lib.DefaultConfig.CUPSConnectTimeout),
		flagToUint(cupsJobQueueSizeFlag, lib.DefaultConfig.CUPSJobQueueSize),
		flagToDurationString(cupsPrinterPollIntervalFlag, lib.DefaultConfig.CUPSPrinterPollInterval),
		lib.DefaultConfig.CUPSPrinterAttributes,
		flagToBool(cupsJobFullUsernameFlag, lib.DefaultConfig.CUPSJobFullUsername),
		flagToBool(cupsIgnoreRawPrintersFlag, lib.DefaultConfig.CUPSIgnoreRawPrinters),
		flagToBool(copyPrinterInfoToDisplayNameFlag, lib.DefaultConfig.CopyPrinterInfoToDisplayName),
		flagToString(monitorSocketFilenameFlag, lib.DefaultConfig.MonitorSocketFilename),
		flagToString(gcpBaseURLFlag, lib.DefaultConfig.GCPBaseURL),
		flagToString(gcpXMPPServerFlag, lib.DefaultConfig.XMPPServer),
		flagToUint16(gcpXMPPPortFlag, lib.DefaultConfig.XMPPPort),
		flagToDurationString(gcpXMPPPingTimeoutFlag, lib.DefaultConfig.XMPPPingTimeout),
		flagToDurationString(gcpXMPPPingIntervalDefaultFlag, lib.DefaultConfig.XMPPPingIntervalDefault),
		flagToString(gcpOAuthClientIDFlag, lib.DefaultConfig.GCPOAuthClientID),
		flagToString(gcpOAuthClientSecretFlag, lib.DefaultConfig.GCPOAuthClientSecret),
		flagToString(gcpOAuthAuthURLFlag, lib.DefaultConfig.GCPOAuthAuthURL),
		flagToString(gcpOAuthTokenURLFlag, lib.DefaultConfig.GCPOAuthTokenURL),
		flagToBool(snmpEnableFlag, lib.DefaultConfig.SNMPEnable),
		flagToString(snmpCommunityFlag, lib.DefaultConfig.SNMPCommunity),
		flagToUint(snmpMaxConnectionsFlag, lib.DefaultConfig.SNMPMaxConnections),
	}

	if err := config.ToFile(); err != nil {
		log.Fatal(err)
	}
}
Ejemplo n.º 2
0
func writeConfigFile(context *cli.Context, config *lib.Config) string {
	if configFilename, err := config.ToFile(context); err != nil {
		log.Fatalln(err)
	} else {
		return configFilename
	}
	panic("unreachable")
}