Skip to content

Commit

Permalink
allow jdbc url starting with jdbc
Browse files Browse the repository at this point in the history
  • Loading branch information
alxgomz committed Sep 25, 2023
1 parent 69bc787 commit 2d3265c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion charts/alfresco-repository/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version: 0.1.0-alpha.9
appVersion: 23.1.0-A21
dependencies:
- name: alfresco-common
version: 3.0.0-alpha.1
version: 3.0.0-alpha.2
repository: https://alfresco.github.io/alfresco-helm-charts/
- name: postgresql
version: 12.5.6
Expand Down
4 changes: 2 additions & 2 deletions charts/alfresco-repository/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Alfresco content repository Helm chart

| Repository | Name | Version |
|------------|------|---------|
| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 3.0.0-alpha.1 |
| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 3.0.0-alpha.2 |
| oci://registry-1.docker.io/bitnamicharts | postgresql | 12.5.6 |

## Configuring Alfresco subsystems
Expand Down Expand Up @@ -105,7 +105,7 @@ environment:
| configuration.db.existingSecret.keys.username | string | `"DATABASE_USERNAME"` | Key within the secret holding the database username |
| configuration.db.existingSecret.name | string | `nil` | Name of a pre-existing secret containing database credentials |
| configuration.db.password | string | `nil` | Password to authentication to the repository database |
| configuration.db.url | string | `nil` | JDBC url of the database WITHOUT the "jdbc:" prefix This is a mandatory parameter |
| configuration.db.url | string | `nil` | JDBC url of the database This is a mandatory parameter |
| configuration.db.username | string | `nil` | Username to authentication to the repository database |
| configuration.hz.port | int | `5701` | Hazelcast listener port Only change it if you use a custom image where the port has been changed from default |
| configuration.messageBroker.existingConfigMap.keys.url | string | `"BROKER_URL"` | Key within the configmap holding the message broker URL. It MUST be a failover URL as per the spec below: https://activemq.apache.org/failover-transport-reference.html |
Expand Down
2 changes: 1 addition & 1 deletion charts/alfresco-repository/templates/_helpers-database.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Usage: include "alfresco-repository.db.cm" (dict "url" "" "driver" "")
*/}}
{{- define "alfresco-repository.db.cm" -}}
DATABASE_URL: {{ .url }}
DATABASE_URL: {{ hasPrefix "jdbc:" .url | ternary .url (print "jdbc:" .url) }}
DATABASE_HOST: {{ template "alfresco-common.db.hostname" .url }}
DATABASE_PORT: {{ include "alfresco-common.db.port" . | quote }}
DATABASE_DRIVER: {{ template "alfresco-common.db.driver" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data:
CATALINA_OPTS: >-
{{- with .Values.configuration }}
-Ddeployment.method=HELM_CHART
-Ddb.url="jdbc:$DATABASE_URL"
-Ddb.url="$DATABASE_URL"
-Ddb.username=${DATABASE_USERNAME}
-Ddb.password=${DATABASE_PASSWORD}
-Ddb.driver="$DATABASE_DRIVER"
Expand Down
23 changes: 6 additions & 17 deletions charts/alfresco-repository/tests/configmap_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ tests:
asserts:
- equal:
path: data.DATABASE_URL
value: mysql://sandy:secret@myhost1:1111
value: jdbc:mysql://sandy:secret@myhost1:1111
- equal:
path: data.DATABASE_HOST
value: myhost1
Expand All @@ -70,11 +70,11 @@ tests:
set:
configuration:
db:
url: postgresql://pghost/alfdb
url: jdbc:postgresql://pghost/alfdb
asserts:
- equal:
path: data.DATABASE_URL
value: postgresql://pghost/alfdb
value: jdbc:postgresql://pghost/alfdb
- equal:
path: data.DATABASE_HOST
value: pghost
Expand All @@ -94,7 +94,7 @@ tests:
asserts:
- equal:
path: data.DATABASE_URL
value: sqlserver://sqlserverhost;databaseName=alfdb;lockTimeout=1000;
value: jdbc:sqlserver://sqlserverhost;databaseName=alfdb;lockTimeout=1000;
- equal:
path: data.DATABASE_HOST
value: sqlserverhost
Expand All @@ -110,11 +110,11 @@ tests:
set:
configuration:
db:
url: oracle:thin:@tcp://mydbhost:1521/mydbservice
url: jdbc:oracle:thin:@tcp://mydbhost:1521/mydbservice
asserts:
- equal:
path: data.DATABASE_URL
value: oracle:thin:@tcp://mydbhost:1521/mydbservice
value: jdbc:oracle:thin:@tcp://mydbhost:1521/mydbservice
- equal:
path: data.DATABASE_HOST
value: mydbhost
Expand All @@ -125,17 +125,6 @@ tests:
path: data.DATABASE_DRIVER
value: oracle.jdbc.OracleDriver

- it: should fail without proper db URL
template: configmap-repository.yaml
set:
configuration:
db:
url: jdbc:mysql://myhost/db
asserts:
- failedTemplate:
errorMessage: >-
database URL MUST be provided WITHOUT the 'jdbc' prefix.
- it: should render ActiveMQ config as needed
template: configmap-mq.yaml
asserts:
Expand Down
2 changes: 1 addition & 1 deletion charts/alfresco-repository/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ configuration:
key: license.lic
purpose: acs-license
db:
# -- JDBC url of the database WITHOUT the "jdbc:" prefix
# -- JDBC url of the database
# This is a mandatory parameter
url: null
# -- JDBC driver class of the driver if none is provided the it is guessed
Expand Down

0 comments on commit 2d3265c

Please sign in to comment.