Documentation ¶
Index ¶
- Constants
- func CheckInternalPermission(identityInfo apistructs.IdentityInfo) bool
- func GetFileContentType(r io.Reader, ext string) string
- func GetFileTypeByExt(ext string) pb.FileType
- type CleanupConfig
- type HTTPHandler
- type KmsConfig
- type LimitConfig
- type LinkConfig
- type OssConfig
- type SecurityConfig
- type ServiceInterface
- type StorageConfig
Constants ¶
View Source
const (
HeaderContentLength = "Content-Length" // The Content-Length entity header indicates the size of the entity-body, in bytes, sent to the recipient.
)
Variables ¶
This section is empty.
Functions ¶
func CheckInternalPermission ¶
func CheckInternalPermission(identityInfo apistructs.IdentityInfo) bool
func GetFileContentType ¶
GetFileContentType judge file content type by file header. If file header is found in allowedContentTypes, return content type, otherwise return application/octet-stream.
Types ¶
type CleanupConfig ¶
type HTTPHandler ¶
type HTTPHandler interface { UploadFile(rw http.ResponseWriter, r *http.Request) DownloadFile(rw http.ResponseWriter, r *http.Request) HeadFile(rw http.ResponseWriter, r *http.Request) DeleteFile(rw http.ResponseWriter, r *http.Request) }
type KmsConfig ¶
type KmsConfig struct {
CmkEtcdKey string `file:"cmk_etcd_key" env:"FILE_KMS_CMD_ETCD_KEY" default:"/dice/cmdb/files/kms/key"`
}
type LimitConfig ¶
type LimitConfig struct { // file upload limit size, default 300MB FileMaxUploadSize datasize.ByteSize `file:"file_max_upload_size" env:"FILE_MAX_UPLOAD_SIZE" default:"300MB"` // the size of the file parts stored in memory, the default value 32M refer to https://github.com/golang/go/blob/5c489514bc5e61ad9b5b07bd7d8ec65d66a0512a/src/net/http/request.go FileMaxMemorySize datasize.ByteSize `file:"file_max_memory_size" env:"FILE_MAX_MEMORY_SIZE" default:"32MB"` }
type LinkConfig ¶
type LinkConfig struct {
UIPublicURL string `file:"ui_public_url" env:"UI_PUBLIC_URL"`
}
type OssConfig ¶
type OssConfig struct { Endpoint string `file:"endpoint" env:"OSS_ENDPOINT"` AccessID string `file:"access_id" env:"OSS_ACCESS_ID"` AccessSecret string `file:"access_secret" env:"OSS_ACCESS_SECRET"` Bucket string `file:"bucket" env:"OSS_BUCKET"` PathPrefix string `file:"path_prefix" env:"OSS_PATH_PREFIX" default:"/dice/cmdb/files"` }
type SecurityConfig ¶
type SecurityConfig struct { // disable file download permission validate temporarily for multi-domain DisableFileDownloadPermissionValidate bool `file:"disable_file_download_permission_validate" env:"DISABLE_FILE_DOWNLOAD_PERMISSION_VALIDATE" default:"false"` // If we allow uploaded file types that can carry active content FileTypeCarryActiveContentAllowed bool `file:"file_type_carry_active_content_allowed" env:"FILETYPE_CARRY_ACTIVE_CONTENT_ALLOWED" default:"false"` // File types can carry active content, separated by comma, can add more types like jsp FileTypesCanCarryActiveContent []string `file:"file_types_can_carry_active_content" env:"FILETYPES_CAN_CARRY_ACTIVE_CONTENT" default:"html,js,xml,htm"` }
type ServiceInterface ¶
type ServiceInterface interface { UploadFile(req filetypes.FileUploadRequest) (*pb.File, error) DownloadFile(w io.Writer, file db.File) (headers map[string]string, err error) DeleteFile(file db.File) error }
ServiceInterface define service methods like a grpc service. For stream reason, we defined a non-methods file service in proto.
type StorageConfig ¶
type StorageConfig struct { // fs // pay attention to sync the value to dice.yml '<%$.Storage.MountPoint%>/dice/cmdb/files:/files:rw' if you change this value StorageMountPointInContainer string `file:"storage_mount_point_in_container" env:"STORAGE_MOUNT_POINT_IN_CONTAINER" default:"/files"` // oss OSS OssConfig `file:"oss"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.