Skip to content

Commit

Permalink
feat: Support HTTP urls for assets
Browse files Browse the repository at this point in the history
  • Loading branch information
timo-reymann committed Mar 29, 2024
1 parent f9c2a67 commit f18bdb2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ services:
YAL_IMAGES_FOLDER: /app/images
# Omit file extension as it will be picked up by name automatically
# each of the entries is searched like ${YAL_IMAGES_FOLDER}/<icon>{png,jpg,jpeg,svg}
# if that does not succeed, an attempt is made to load the path as is and if
# there is no such file it tries to load it as an URL.
YAL_MASCOT: mascot # the mascot to display on the left
YAL_LOGO: logo # logo to display on the right
YAL_BACKGROUND: background # background image for page
Expand Down
4 changes: 3 additions & 1 deletion pkg/config/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ func envWithDefault(variable string, fallback string) string {
func imageFromEnv(variable string, fallbackFile string) (string, error) {
path := envWithDefault(variable, fallbackFile)
resolvedPath, err := assets.LookupImgAnyExt(path2.Join(ImageFolder(), path))
// in case file can not be found locally try to load from URL
// or search for full file name
if err != nil {
return "", err
return assets.InlineIcon(path)
}

return assets.InlineIcon(resolvedPath)
Expand Down

0 comments on commit f18bdb2

Please sign in to comment.