@@ -56,25 +56,31 @@ protected function configure(): void
5656 $ this
5757 ->setDescription ('Requests certificates from Let \'s Encrypt for the given domains and notifies Kong ' )
5858 ->addArgument (
59- 'kong-endpoint ' ,
60- InputArgument::REQUIRED ,
61- 'Base URL to Kong Admin API; eg: https://foo:8001 '
59+ name: 'kong-endpoint ' ,
60+ mode: InputArgument::REQUIRED ,
61+ description: 'Base URL to Kong Admin API; eg: https://foo:8001 '
6262 )
6363 ->addArgument (
64- 'email ' ,
65- InputArgument::REQUIRED ,
66- 'Email the set of domains is to be associated with at Let \'s Encrypt '
64+ name: 'email ' ,
65+ mode: InputArgument::REQUIRED ,
66+ description: 'Email the set of domains is to be associated with at Let \'s Encrypt '
6767 )
6868 ->addArgument (
69- 'domains ' ,
70- InputArgument::REQUIRED ,
71- 'Comma separated list of domains to request certs for; eg: bar.com,foo.bar.com '
69+ name: 'domains ' ,
70+ mode: InputArgument::REQUIRED ,
71+ description: 'Comma separated list of domains to request certs for; eg: bar.com,foo.bar.com '
7272 )
7373 ->addOption (
74- 'test-cert ' ,
75- 't ' ,
76- InputOption::VALUE_NONE ,
77- 'Require test certificate from staging-letsencrypt '
74+ name: 'test-cert ' ,
75+ shortcut: 't ' ,
76+ mode: InputOption::VALUE_NONE ,
77+ description: 'Require test certificate from staging-letsencrypt '
78+ )
79+ ->addOption (
80+ name: 'allow-self-signed-cert-kong ' ,
81+ shortcut: '-s ' ,
82+ mode: InputOption::VALUE_NONE ,
83+ description: "Allow self signed certs in Kong's admin endpoint " ,
7884 );
7985 }
8086
@@ -107,6 +113,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
107113 /** @var bool $testCert */
108114 $ testCert = $ input ->getOption ('test-cert ' );
109115
116+ /** @var bool $allowSelfSignedCert */
117+ $ allowSelfSignedCert = $ input ->getOption ('allow-self-signed-cert-kong ' );
118+
110119 $ this ->validateInput ($ email , $ kongAdminUri , $ domains );
111120
112121 // Acquire certificates from certbot. This is not all-or-nothing, whatever certs we acquire come out here
@@ -116,7 +125,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
116125 $ certificate = $ this ->certbot ->acquireCertificate ($ domains , $ email , $ testCert );
117126
118127 // Store certs into kong via the admin UI. Again, not all-or-nothing
119- if ($ this ->kong ->store ($ certificate , $ kongAdminUri ) === true ) {
128+ if ($ this ->kong ->store ($ certificate , $ kongAdminUri, $ allowSelfSignedCert ) === true ) {
120129 $ certOrCerts = count ($ certificate ->getDomains ()) > 1 ? 'Certificates ' : 'Certificate ' ;
121130
122131 $ output ->writeln (sprintf ('%s for %s correctly sent to Kong ' , $ certOrCerts , $ outputDomains ));
0 commit comments