Example #1
0
        private static int Main(string[] args)
        {
            var p = new CertifyCLI();

            p.ShowVersion();

            if (!p.IsServiceAvailable().Result)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                System.Console.WriteLine("Certify SSL Manager service not started.");
                Console.ForegroundColor = ConsoleColor.White;
                return(-1);
            }

            Task.Run(async() =>
            {
                await p.LoadPreferences();
            });

            if (args.Length == 0)
            {
                p.ShowHelp();
                p.ShowACMEInfo();
            }
            else
            {
                p.ShowACMEInfo();

                if (args.Contains("renew", StringComparer.InvariantCultureIgnoreCase))
                {
                    // perform auto renew all
                    var renewalTask = p.PerformAutoRenew();
                    renewalTask.ConfigureAwait(true);
                    renewalTask.Wait();
                }

                if (args.Contains("list", StringComparer.InvariantCultureIgnoreCase))
                {
                    //list managed sites and status
                    p.ListManagedSites();
                }
            }

#if DEBUG
            p.ListManagedSites();
            Console.ReadKey();
#endif
            return(0);
        }
Example #2
0
        private static int Main(string[] args)
        {
            // upgrade assembly version of saved settings (if required)
            Certify.Properties.Settings.Default.UpgradeSettingsVersion(); // deprecated
            Certify.Management.SettingsManager.LoadAppSettings();

            var p = new CertifyCLI();

            p.ShowVersion();

            if (args.Length == 0)
            {
                p.ShowHelp();
                p.ShowACMEInfo();
            }
            else
            {
                p.ShowACMEInfo();

                if (args.Contains("cleanup", StringComparer.InvariantCultureIgnoreCase))
                {
                    // cleanup vault
                    p.PerformVaultCleanup();
                }

                if (args.Contains("renew", StringComparer.InvariantCultureIgnoreCase))
                {
                    // perform auto renew all
                    var renewalTask = p.PerformAutoRenew();
                    renewalTask.ConfigureAwait(true);
                    renewalTask.Wait();

                    // now perform vault cleanup
                    p.PerformVaultCleanup();
                }

                if (args.Contains("list", StringComparer.InvariantCultureIgnoreCase))
                {
                    //list managed sites and status
                    p.ListManagedSites();
                }
            }

#if DEBUG
            Console.ReadKey();
#endif
            return(0);
        }