@digitraffic/common 2025.1.16-1 → 2025.1.16-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,7 +29,11 @@ export interface ClusterConfiguration {
|
|
29
29
|
export interface ClusterImportConfiguration {
|
30
30
|
readonly clusterReadEndpoint: string;
|
31
31
|
readonly clusterWriteEndpoint: string;
|
32
|
-
|
32
|
+
/** Override clusterIdentifier if clusterWriteEndpoint name doesn't contain
|
33
|
+
* clusterIdentifier before '.cluster' substring.
|
34
|
+
* clusterWriteEndpoint name that is normally formed stackenv-stackenvxxx-xxx.cluster-xxx.region.rds.amazonaws.com
|
35
|
+
* and we can parse clusterIdentifier from it. */
|
36
|
+
readonly clusterIdentifier?: string;
|
33
37
|
}
|
34
38
|
/**
|
35
39
|
* Stack that creates DatabaseCluster.
|
@@ -42,7 +42,24 @@ export class DbStack extends Stack {
|
|
42
42
|
if (configuration.clusterImport) {
|
43
43
|
createParameter(this, "cluster.reader", configuration.clusterImport.clusterReadEndpoint);
|
44
44
|
createParameter(this, "cluster.writer", configuration.clusterImport.clusterWriteEndpoint);
|
45
|
-
|
45
|
+
// If clusterIdentifier is provided we use it and otherwise we try to parse it from
|
46
|
+
// from clusterWriteEndpoint name that is normally formed stackenv-stackenvxxx-xxx.cluster-xxx.region.rds.amazonaws.com
|
47
|
+
// and part before .cluster is clusterIdentifier.
|
48
|
+
if (configuration.clusterImport.clusterIdentifier) {
|
49
|
+
this.clusterIdentifier = configuration.clusterImport.clusterIdentifier;
|
50
|
+
}
|
51
|
+
else if (configuration.clusterImport.clusterWriteEndpoint !== undefined &&
|
52
|
+
configuration.clusterImport.clusterWriteEndpoint.split('.cluster')[0] !== undefined &&
|
53
|
+
configuration.clusterImport.clusterWriteEndpoint.split('.cluster')[0] !== configuration.clusterImport.clusterWriteEndpoint) {
|
54
|
+
// @ts-ignore We check that this is defined
|
55
|
+
this.clusterIdentifier = configuration.clusterImport.clusterWriteEndpoint.split('.cluster')[0];
|
56
|
+
}
|
57
|
+
else {
|
58
|
+
throw new Error("Could not resolve 'clusterIdentifier' from 'configuration.clusterImport': " +
|
59
|
+
configuration.clusterImport.clusterWriteEndpoint +
|
60
|
+
" Either 'configuration.clusterImport.clusterReadEndpoint' didn't contain '.cluster' or " +
|
61
|
+
"configuration.clusterImport.clusterIdentifier was not defined to override default value.");
|
62
|
+
}
|
46
63
|
}
|
47
64
|
}
|
48
65
|
createParameterGroups(customVersions, workmem) {
|