Skip to content

Commit

Permalink
Move default pki_instance_name into default.cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
edewata committed Jul 7, 2023
1 parent c60babb commit a002a73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
3 changes: 2 additions & 1 deletion base/server/etc/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ destroy_scriplets=
# case someone wants to override them in their config file.
#
# Tomcat instances:
# pki_instance_name=pki-tomcat
# pki_https_port=8443
# pki_http_port=8080

pki_instance_name=pki-tomcat

pki_admin_setup=True
pki_admin_cert_file=%(pki_client_dir)s/ca_admin.cert
pki_admin_cert_request_type=pkcs10
Expand Down
11 changes: 3 additions & 8 deletions base/server/python/pki/server/deployment/pkiparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,6 @@ def init_config(self, pki_instance_name=None):
self.deployer.nss_db_type = self.get_nss_db_type()
java_home = self._getenv('JAVA_HOME').strip()

# Check if a instance name is provided before assigning a default
# instance_name
if pki_instance_name:
default_instance_name = pki_instance_name
else:
default_instance_name = 'pki-tomcat'

default_http_port = '8080'
default_https_port = '8443'

Expand All @@ -324,7 +317,6 @@ def init_config(self, pki_instance_name=None):
charset = string.digits + string.ascii_lowercase + string.ascii_uppercase
self.deployer.main_config = configparser.ConfigParser({
'application_version': application_version,
'pki_instance_name': default_instance_name,
'pki_http_port': default_http_port,
'pki_https_port': default_https_port,
'pki_dns_domainname': self.deployer.dns_domainname,
Expand All @@ -336,6 +328,9 @@ def init_config(self, pki_instance_name=None):
'pki_hostname': self.deployer.hostname,
'pki_random_ajp_secret': pki.generate_password(charset, length=25)})

if pki_instance_name:
self.deployer.main_config.set('DEFAULT', 'pki_instance_name', pki_instance_name)

# Make keys case-sensitive!
self.deployer.main_config.optionxform = str

Expand Down

0 comments on commit a002a73

Please sign in to comment.