mirror of
https://github.com/Luzifer/share.git
synced 2024-12-20 10:31:16 +00:00
Document templating
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
081f2e22b7
commit
70c08ccbc7
1 changed files with 15 additions and 0 deletions
15
README.md
15
README.md
|
@ -22,3 +22,18 @@ The frontend can be used in all modern browsers. Internet Explorer is not suppor
|
|||
- Share the URL you received from last step
|
||||
|
||||
After you've updated the binary you need to run the `--bootstrap` command once more to have the latest interface changes uploaded to your bucket.
|
||||
|
||||
### Templating in `file-template`
|
||||
|
||||
You can specify where in the bucket the file should be stored and how it should be named by passing the `--file-template` parameter. It takes a Go template with these placeholders:
|
||||
|
||||
- `{{ .Ext }}` - The extension of the file (including the leading dot, i.e. `.txt`)
|
||||
- `{{ .FileName }}` - The original filename without changes (i.e. `my video.mp4`)
|
||||
- `{{ .Hash }}` - The SHA1 hash of the file content
|
||||
- `{{ .SafeFileName }}` - URL-safe version of the filename (i.e. `my-video.mp4`)
|
||||
- `{{ .UUID }}` - Random UUIDv4 to be used within the URL to make it hard to guess
|
||||
|
||||
Examples:
|
||||
|
||||
- `--file-template="file/{{ printf \"%.8s\" .Hash}}/{{ .SafeFileName }}"`
|
||||
- `--file-template="file/{{ printf \"%.8s\" .Hash}}/{{ .UUID }}{{ .Ext }}"`
|
||||
|
|
Loading…
Reference in a new issue