View Source Imglab.Source (imglab v0.3.0)
Provides a way to define and store information about a imglab source.
Link to this section Summary
Functions
Returns a Source struct with the specified options for the source.
Link to this section Types
Link to this section Functions
Returns a Source struct with the specified options for the source.
name
must be a string
indicating the name of the source.
options
Options
The accepted options are:
:host
- astring
specifying the host where the imglab server is located, only for imglab on-premises (default:"imglab-cdn.net"
):https
- aboolean
value specifying if the source should use https or not (default:true
):port
- a:inet.port_number
specifying a port where the imglab server is located, only for imglab on-premises:secure_key
- astring
specifying the source secure key:secure_salt
- astring
specifying the source secure salt:subdomains
- aboolean
value specifying if the source should be specified using subdomains instead of using the path, only for imglab on-premises (default:true
)
Note:
secure_key
andsecure_salt
parameters are secrets that should not be added to the code. Please use environment vars or other secure method to use them in your project.
examples
Examples
iex> Imglab.Source.new("assets")
%Imglab.Source{
host: "imglab-cdn.net",
https: true,
name: "assets",
port: nil,
secure_key: nil,
secure_salt: nil,
subdomains: true
}
iex> Imglab.Source.new("assets", subdomains: false)
%Imglab.Source{
host: "imglab-cdn.net",
https: true,
name: "assets",
port: nil,
secure_key: nil,
secure_salt: nil,
subdomains: false
}
iex> Imglab.Source.new("assets", https: false, host: "imglab.net", port: 8080)
%Imglab.Source{
host: "imglab.net",
https: false,
name: "assets",
port: 8080,
secure_key: nil,
secure_salt: nil,
subdomains: true
}
iex> Imglab.Source.new("assets", secure_key: "secure-key", secure_salt: "secure-salt")
%Imglab.Source{
host: "imglab-cdn.net",
https: true,
name: "assets",
port: nil,
secure_key: "secure-key",
secure_salt: "secure-salt",
subdomains: true
}