Imglab.Source (imglab v0.1.0) View Source
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
Specs
Link to this section Functions
Specs
Returns a Source struct with the specified options for the source.
name must be a string indicating the name of the source.
Options
The accepted options are:
:host- astringspecifying the host where the imglab server is located, only for imglab on-premises (default:"cdn.imglab.io"):https- abooleanvalue specifying if the source should use https or not (default:true):port- a:inet.port_numberspecifying a port where the imglab server is located, only for imglab on-premises:secure_key- astringspecifying the source secure key:secure_salt- astringspecifying the source secure salt:subdomains- abooleanvalue specifying if the source should be specified using subdomains instead of using the path, only for imglab on-premises (default:false)
Note:
secure_keyandsecure_saltparamaters 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
iex> Imglab.Source.new("assets")
%Imglab.Source{
host: "cdn.imglab.io",
https: true,
name: "assets",
port: nil,
secure_key: nil,
secure_salt: nil,
subdomains: false
}
iex> Imglab.Source.new("assets", subdomains: true)
%Imglab.Source{
host: "cdn.imglab.io",
https: true,
name: "assets",
port: nil,
secure_key: nil,
secure_salt: nil,
subdomains: true
}
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: false
}
iex> Imglab.Source.new("assets", secure_key: "secure-key", secure_salt: "secure-salt")
%Imglab.Source{
host: "cdn.imglab.io",
https: true,
name: "assets",
port: nil,
secure_key: "secure-key",
secure_salt: "secure-salt",
subdomains: false
}