v1.7.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2022 License: MIT Imports: 6 Imported by: 4



Package config defines the Cloudinary configuration.



This section is empty.


This section is empty.


This section is empty.


type API added in v1.0.0

type API struct {
	UploadPrefix  string `schema:"upload_prefix" default:""`
	Timeout       int64  `schema:"timeout" default:"60"` // seconds
	UploadTimeout int64  `schema:"upload_timeout"`
	ChunkSize     int64  `schema:"chunk_size" default:"20000000"` // bytes

API defines the configuration for making requests to the Cloudinary API.

type AuthToken added in v1.2.0

type AuthToken struct {
	Key        string `schema:"key"`
	IP         string `schema:"ip"`
	ACL        string `schema:"acl"`
	StartTime  int64  `schema:"start_time"`
	Expiration int64  `schema:"expiration"`
	Duration   int64  `schema:"duration"`

AuthToken defines the configuration for delivering token-based authenticated media assets.

type Cloud added in v1.0.0

type Cloud struct {
	CloudName          string `schema:"-"`
	APIKey             string `schema:"-"`
	APISecret          string `schema:"-"`
	OAuthToken         string `schema:"oauth_token"`
	SignatureAlgorithm string `schema:"signature_algorithm"`

Cloud defines the cloud configuration required to connect your application to Cloudinary.

func (Cloud) GetSignatureAlgorithm added in v1.2.0

func (c Cloud) GetSignatureAlgorithm() string

GetSignatureAlgorithm returns the signature algorithm.

type Configuration

type Configuration struct {
	Cloud     Cloud
	API       API
	URL       URL
	AuthToken AuthToken

Configuration is the main configuration struct.

func New added in v1.0.0

func New() (*Configuration, error)

New returns a new Configuration instance from the environment variable

func NewFromOAuthToken added in v1.6.0

func NewFromOAuthToken(cloud string, oAuthToken string) (*Configuration, error)

NewFromOAuthToken returns a new Configuration instance from the provided cloud name and OAuth token.

func NewFromParams added in v1.0.0

func NewFromParams(cloud string, key string, secret string) (*Configuration, error)

NewFromParams returns a new Configuration instance from the provided parameters.

func NewFromQueryParams added in v1.3.0

func NewFromQueryParams(cloud string, key string, secret string, params map[string][]string) (*Configuration, error)

NewFromQueryParams returns a new Configuration instance from the provided url query parameters.

func NewFromURL added in v1.0.0

func NewFromURL(cldURLStr string) (*Configuration, error)

NewFromURL returns a new Configuration instance from a cloudinary url.

type URL added in v1.2.0

type URL struct {
	Domain             string `schema:"-" default:""`
	SubDomain          string `schema:"-" default:"res"`
	SharedHost         string `schema:"-" default:""`
	CName              string `schema:"cname"`
	SecureCName        string `schema:"secure_cname"`
	Secure             bool   `schema:"secure" default:"true"`
	CDNSubDomain       bool   `schema:"cdn_sub_domain"`
	SecureCDNSubDomain bool   `schema:"secure_cdn_sub_domain"`
	PrivateCDN         bool   `schema:"private_cdn"`
	SignURL            bool   `schema:"sign_url"`
	LongURLSignature   bool   `schema:"long_url_signature"`
	Shorten            bool   `schema:"shorten"`
	UseRootPath        bool   `schema:"use_root_path"`
	ForceVersion       bool   `schema:"force_version" default:"true"`
	Analytics          bool   `schema:"analytics" default:"true"`

URL defines the configuration applied when generating Cloudinary URLs.

func (URL) GetSignatureLength added in v1.2.0

func (uc URL) GetSignatureLength() uint8

GetSignatureLength returns the length of the URL signature.

func (URL) Protocol added in v1.2.0

func (uc URL) Protocol() string

Protocol returns URL protocol (http or https).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL