Skip to content

Commit 2c91b13

Browse files
authored
Cloudinary NG service api to update configuration during runtime (#302)
1 parent 4f6fcea commit 2c91b13

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Please consult with the respective README file of each sample for usage and addi
195195
* **test** - Compiles TypeScript and runs unit tests on the generated JS files, re-running tests automatically on chages
196196
* **test-once** - Compiles TypeSCript and executes unit tests once, closing the browser once it's done
197197
* **pree2e** - Updates WebDriver binary
198-
* **start-sample** - Starts the photo album sample, without automatically opening the browser and navingating to the started app
198+
* **start-sample** - Starts the photo album sample, without automatically opening the browser and navigating to the started app
199199
* **start-sample:jquery** - Same as *start-sample* for the jQuery sample
200200
* **install-sample-from-source** - Compiles TypeScript, packs this module and installs it into samples/photo_album
201201
* **install-sample-from-source:jquery** - Same as *install-sample-from-source* for the jQuery sample

projects/angular-cld/src/lib/cloudinary.service.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ describe('Cloudinary service', () => {
2222
expect(service instanceof Cloudinary).toBe(true);
2323
});
2424

25+
it('updates the configuration', () => {
26+
27+
const newConfig: CloudinaryConfiguration = {
28+
cloud_name: 'new-service-test'
29+
};
30+
31+
service.updateConfig(newConfig)
32+
33+
expect(service.config().cloud_name).toEqual(newConfig.cloud_name);
34+
});
35+
2536
it('creates responsive urls by interacting with cloudinary core', () => {
2637
const imgElement = {} as HTMLImageElement;
2738
const options = {

projects/angular-cld/src/lib/cloudinary.service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ export class Cloudinary {
8585
return this._cloudinaryInstance.config();
8686
}
8787

88+
updateConfig(configuration: CloudinaryConfiguration) {
89+
this._cloudinaryInstance.config(configuration);
90+
}
91+
8892
url(...parameters): string {
8993
return this._cloudinaryInstance.url(...parameters);
9094
}

0 commit comments

Comments
 (0)