-
Notifications
You must be signed in to change notification settings - Fork 151
Expand file tree
/
Copy pathCloudConfig.php
More file actions
105 lines (89 loc) · 3.09 KB
/
CloudConfig.php
File metadata and controls
105 lines (89 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
/**
* This file is part of the Cloudinary PHP package.
*
* (c) Cloudinary
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cloudinary\Configuration;
use Cloudinary\Utils;
/**
* Defines the cloud configuration required to connect your application to Cloudinary.
* **Learn more**: <a
* href="https://cloudinary.com/documentation/how_to_integrate_cloudinary#get_familiar_with_the_cloudinary_console"
* target="_blank">Get account details from the Cloudinary Console.</a>
*
* @property ?string $signatureAlgorithm By default, set to self::DEFAULT_SIGNATURE_ALGORITHM.
* @property ?int $signatureVersion By default, set to self::DEFAULT_SIGNATURE_VERSION.
*
* @api
*/
class CloudConfig extends BaseConfigSection
{
use CloudConfigTrait;
public const CONFIG_NAME = 'cloud';
public const DEFAULT_SIGNATURE_ALGORITHM = Utils::ALGO_SHA1;
public const DEFAULT_SIGNATURE_VERSION = 2;
// Supported parameters
public const CLOUD_NAME = 'cloud_name';
public const API_KEY = 'api_key';
public const API_SECRET = 'api_secret';
public const OAUTH_TOKEN = 'oauth_token';
public const SIGNATURE_ALGORITHM = 'signature_algorithm';
public const SIGNATURE_VERSION = 'signature_version';
/**
* @var array of configuration keys that contain sensitive data that should not be exported (for example api key)
*/
protected static array $sensitiveDataKeys = [self::API_KEY, self::API_SECRET, self::OAUTH_TOKEN];
/**
* Mandatory. The name of your Cloudinary cloud. Used to build the public URL for all your media assets.
*/
public ?string $cloudName = null;
/**
* Mandatory for server-side operations. Used together with the API secret to communicate with the Cloudinary API
* and sign requests.
*/
public ?string $apiKey = null;
/**
* Mandatory for server-side operations. Used together with the API key to communicate with the Cloudinary API and
* sign requests.
*/
public ?string $apiSecret = null;
/**
* Optional for sever-side operations. Can be passed instead of passing API key and API secret.
*/
public ?string $oauthToken = null;
/**
* Sets a signature algorithm (SHA1 by default).
*/
protected ?string $signatureAlgorithm = null;
/**
* Sets the signature version (2 by default).
*/
protected ?int $signatureVersion = null;
/**
* Serialises configuration section to a string representation.
*
* @return string
*/
public function __toString()
{
return $this->toString([self::CLOUD_NAME, self::API_KEY, self::API_SECRET]);
}
/**
* Sets the configuration key with the specified value.
*
* @param string $configKey The configuration key.
* @param mixed $configValue THe configuration value.
*
* @return $this
*
* @internal
*/
public function setCloudConfig(string $configKey, mixed $configValue): static
{
return $this->setConfig($configKey, $configValue);
}
}