Class: Configuration

Configuration


new Configuration(options)

Cloudinary configuration class

Parameters:
Name Type Description
options object

configuration parameters

Members


<static, constant> DEFAULT_CONFIGURATION_PARAMS :object

Defaults configuration.

Type:
  • object

Methods


#config(new_config, new_value)

Create or modify the Cloudinary client configuration

Warning: config() returns the actual internal configuration object. modifying it will change the configuration.

This is a backward compatibility method. For new code, use get(), merge() etc.

Parameters:
Name Type Description
new_config hash | string | boolean
new_value string
See:
  • fromEnvironment for initialization using environment variables
  • fromDocument for initialization using HTML meta tags
Returns: *

configuration, or value

Type
*

#fromDocument()

Initialize Cloudinary from HTML meta tags.

Returns: Configuration
Type
Configuration
Example
<meta name="cloudinary_cloud_name" content="mycloud">

#fromEnvironment()

Initialize Cloudinary from the CLOUDINARY_URL environment variable.

This function will only run under Node.js environment.

Requires:
  • module:Node.js

#get(name)

Get the value of a configuration item

Parameters:
Name Type Description
name string

the name of the item to set

Returns: *

the configuration item

Type
*

#init()

Initialize the configuration. The function first tries to retrieve the configuration form the environment and then from the document.

See:
  • fromDocument
  • fromEnvironment
Returns: Configuration

returns this for chaining

Type
Configuration

#set(name, value)

Set a new configuration item

Parameters:
Name Type Description
name String

the name of the item to set

value *

the value to be set

Returns: Configuration
Type
Configuration

#toOptions()

Returns a copy of the configuration parameters

Returns: Object

a key:value collection of the configuration parameters

Type
Object