Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CACHE_DIR = os.Getenv("CDN_CACHE_DIR")
Functions ¶
func CDN ¶
CDN returns a function that may be used to return either the cdnUrl or a local relative url, depending on mountPoint.
If mountPoint is empty, nothing is cached and the cdnUrl is returned.
Otherwise a fileserver is mounted at mountPoint, serving the files from cache directory located at CDN_CACHE_DIR or - if not set - at tmp/cdn_cache. Any call to the returned function will then ensure that the corresponding file was downloaded to the cache directory and thus can be served by the fileserver.
mountPoint must either be empty or begin and end with /
An invalid mountPoint or an invalid cdnUrl results in a panic.
Types ¶
Click to show internal directories.
Click to hide internal directories.