Skip to content

Commit

Permalink
Merge pull request #372 from ucam-department-of-psychiatry/camcops-do…
Browse files Browse the repository at this point in the history
…cker-fix

Fix installer to set the SSL config options only if using https directly
  • Loading branch information
martinburchell authored Aug 6, 2024
2 parents 7cd5b67 + d45e9cb commit 74cef7c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3931,3 +3931,6 @@ Current C++/SQLite client, Python/SQLAlchemy server
- Fix bugs in the "strict" validation of double-precision floating-point values
where valid values were being rejected.
https:/ucam-department-of-psychiatry/camcops/issues/368

- Fix the installer to set the SSL options in the config file only if using
HTTPS directly.
19 changes: 13 additions & 6 deletions server/installer/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,17 @@ def create_config(self) -> None:
self.configure_config()

def configure_config(self) -> None:
ssl_certificate = ""
ssl_private_key = ""

if self.use_https():
ssl_certificate = os.path.join(
DockerPath.CONFIG_DIR, "camcops.crt"
)
ssl_private_key = os.path.join(
DockerPath.CONFIG_DIR, "camcops.key"
)

replace_dict = {
"db_server": os.getenv(
InstallerEnvVar.MYSQL_SERVER,
Expand All @@ -625,12 +636,8 @@ def configure_config(self) -> None:
DockerEnvVar.MYSQL_DATABASE_NAME,
),
"host": "0.0.0.0",
"ssl_certificate": os.path.join(
DockerPath.CONFIG_DIR, "camcops.crt"
),
"ssl_private_key": os.path.join(
DockerPath.CONFIG_DIR, "camcops.key"
),
"ssl_certificate": ssl_certificate,
"ssl_private_key": ssl_private_key,
}

self.search_replace_file(self.config_full_path(), replace_dict)
Expand Down

0 comments on commit 74cef7c

Please sign in to comment.