Skip to content

Commit fadab4b

Browse files
authored
fix(pci.project.storages.container): update gateway url constant (#1140)
ref: MBE-381
1 parent a342be4 commit fadab4b

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import find from 'lodash/find';
22

3-
import { STORAGE_GATEWAY } from './containers.constants';
4-
53
export default class Container {
64
constructor(resource) {
75
this.publicUrl = null;
@@ -11,8 +9,4 @@ export default class Container {
119
getObjectById(objectId) {
1210
return find(this.objects, { name: objectId });
1311
}
14-
15-
get storageGateway() {
16-
return STORAGE_GATEWAY.replace('REGION', this.region.toLowerCase());
17-
}
1812
}

packages/manager/modules/pci/src/projects/project/storages/containers/containers.constants.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ export const CONTAINER_DEFAULT_PASSWORD = [
3535
CONTAINER_DEFAULT_PASSWORD_PASSWORD,
3636
].join('.');
3737

38-
export const STORAGE_GATEWAY = 'gateways.storage.REGION.cloud.ovh.net';
38+
export const STORAGE_GATEWAY = {
39+
CA: 'gateways.storage.REGION.cloud.ovh.net',
40+
EU: 'gateways.storage.REGION.cloud.ovh.net',
41+
US: 'gateways.storage.REGION.cloud.ovh.us',
42+
};
3943

4044
export const X_CONTAINER_HEADERS_REGEX = /^(X-Container|X-Storage)/i;
4145

packages/manager/modules/pci/src/projects/project/storages/containers/containers.service.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
OBJECT_CONTAINER_TYPE_STATIC,
1717
OBJECT_CONTAINER_TYPE_PUBLIC,
1818
OBJECT_TYPE_SEALED,
19+
STORAGE_GATEWAY,
1920
X_AUTH_TOKEN,
2021
X_CONTAINER_HEADERS_REGEX,
2122
X_CONTAINER_READ,
@@ -27,11 +28,13 @@ export default class PciStoragesContainersService {
2728
constructor(
2829
$http,
2930
$q,
31+
coreConfig,
3032
OvhApiCloudProjectStorage,
3133
OvhApiCloudProjectUser,
3234
) {
3335
this.$http = $http;
3436
this.$q = $q;
37+
this.coreConfig = coreConfig;
3538
this.OvhApiCloudProjectStorage = OvhApiCloudProjectStorage;
3639
this.OvhApiCloudProjectUser = OvhApiCloudProjectUser;
3740
}
@@ -152,6 +155,10 @@ export default class PciStoragesContainersService {
152155
objects: map(container.objects, object => new ContainerObject(object)),
153156
id: containerId,
154157
publicUrl,
158+
storageGateway: STORAGE_GATEWAY[this.coreConfig.getRegion()].replace(
159+
'REGION',
160+
container.region.toLowerCase(),
161+
),
155162
}));
156163
}
157164

0 commit comments

Comments
 (0)