zitadel/internal/domain/asset.go
Livio Amstutz ab62f2d79d
fix: return full url of assets in admin and mgmt api (#3157)
* fix: return full url of assets in admin and mgmt api

* remove asset loading over asset service

* remove unused code

Co-authored-by: Max Peintner <max@caos.ch>
2022-02-04 15:02:18 +01:00

47 lines
1.1 KiB
Go

package domain
import "time"
const (
UsersAssetPath = "users"
AvatarAssetPath = "/avatar"
policyPrefix = "policy"
LabelPolicyPrefix = policyPrefix + "/label"
labelPolicyLogoPrefix = LabelPolicyPrefix + "/logo"
labelPolicyIconPrefix = LabelPolicyPrefix + "/icon"
labelPolicyFontPrefix = LabelPolicyPrefix + "/font"
Dark = "dark"
CssPath = LabelPolicyPrefix + "/css"
CssVariablesFileName = "variables.css"
LabelPolicyLogoPath = labelPolicyLogoPrefix
LabelPolicyIconPath = labelPolicyIconPrefix
LabelPolicyFontPath = labelPolicyFontPrefix
)
type AssetInfo struct {
Bucket string
Key string
ETag string
Size int64
LastModified time.Time
Location string
VersionID string
Expiration time.Time
AutheticatedURL string
ContentType string
}
func GetHumanAvatarAssetPath(userID string) string {
return UsersAssetPath + "/" + userID + AvatarAssetPath
}
func AssetURL(prefix, resourceOwner, key string) string {
if prefix == "" || resourceOwner == "" || key == "" {
return ""
}
return prefix + resourceOwner + "/" + key
}