mirror of
https://github.com/Forceu/Gokapi.git
synced 2026-02-05 16:08:35 -06:00
Added .env and updated docker-compose, removed unused GOKAPI_DATABASE_URL and GOKAPI_AWS_PROXY_DOWNLOAD
This commit is contained in:
36
.env.dist
Normal file
36
.env.dist
Normal file
@@ -0,0 +1,36 @@
|
||||
# Timezone
|
||||
TZ=UTC
|
||||
#TZ=Europe/Berlin
|
||||
|
||||
|
||||
# Optional S3
|
||||
#GOKAPI_AWS_BUCKET=
|
||||
#GOKAPI_AWS_REGION=
|
||||
#GOKAPI_AWS_KEY=
|
||||
#GOKAPI_AWS_KEY_SECRET=
|
||||
#GOKAPI_AWS_ENDPOINT=
|
||||
|
||||
|
||||
# ID Lengths
|
||||
#GOKAPI_LENGTH_ID=15
|
||||
#GOKAPI_LENGTH_HOTLINK_ID=40
|
||||
|
||||
|
||||
# App Directories
|
||||
#GOKAPI_CONFIG_DIR=config
|
||||
#GOKAPI_CONFIG_FILE=config.json
|
||||
#GOKAPI_DATA_DIR=data
|
||||
|
||||
# Chunk & Upload Config
|
||||
#GOKAPI_CHUNK_SIZE_MB=45
|
||||
#GOKAPI_MAX_FILESIZE=102400
|
||||
#GOKAPI_MAX_MEMORY_UPLOAD=50
|
||||
#GOKAPI_MAX_PARALLEL_UPLOADS=4
|
||||
#TMPDIR=/app/data/tmp
|
||||
|
||||
|
||||
# Other flags
|
||||
#GOKAPI_DISABLE_CORS_CHECK=false
|
||||
#GOKAPI_LOG_STDOUT=false
|
||||
#GOKAPI_ENABLE_HOTLINK_VIDEOS=false
|
||||
#DOCKER_NONROOT=false
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -12,3 +12,4 @@ internal/webserver/web/static/js/wasm_exec.js
|
||||
internal/webserver/web/static/js/min/wasm_exec.min.js
|
||||
.vendor/
|
||||
custom/
|
||||
.env
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
services:
|
||||
gokapi:
|
||||
image: f0rc3/gokapi:latest
|
||||
container_name: gokapi
|
||||
ports:
|
||||
- "127.0.0.1:53842:53842"
|
||||
volumes:
|
||||
- gokapi-data:/app/data
|
||||
- gokapi-config:/app/config
|
||||
restart: always
|
||||
|
||||
services:
|
||||
gokapi:
|
||||
image: f0rc3/gokapi:latest
|
||||
container_name: gokapi
|
||||
ports:
|
||||
- "53842:53842"
|
||||
environment:
|
||||
- TZ=UTC
|
||||
volumes:
|
||||
- ./gokapi-data:/app/data
|
||||
- ./gokapi-config:/app/config
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
gokapi-data:
|
||||
gokapi-config:
|
||||
volumes:
|
||||
gokapi-data:
|
||||
gokapi-config:
|
||||
|
||||
env_file:
|
||||
- path: "./.env"
|
||||
required: true
|
||||
|
||||
@@ -68,8 +68,6 @@ Available environment variables
|
||||
+-------------------------------+-------------------------------------------------------------------------------------+-----------------+--------------------------------------+
|
||||
| GOKAPI_DATA_DIR | Sets the directory for the data | Yes | data |
|
||||
+-------------------------------+-------------------------------------------------------------------------------------+-----------------+--------------------------------------+
|
||||
| GOKAPI_DATABASE_URL | Sets the type and location of the database. See :ref:`Databases` | Yes | sqlite://[data folder]/gokapi.sqlite |
|
||||
+-------------------------------+-------------------------------------------------------------------------------------+-----------------+--------------------------------------+
|
||||
| GOKAPI_LENGTH_ID | Sets the length of the download IDs. Value needs to be 5 or more | No | 15 |
|
||||
+-------------------------------+-------------------------------------------------------------------------------------+-----------------+--------------------------------------+
|
||||
| GOKAPI_LENGTH_HOTLINK_ID | Sets the length of the hotlink IDs. Value needs to be 8 or more | No | 40 |
|
||||
@@ -121,14 +119,6 @@ All values that are described in :ref:`cloudstorage` can be passed as environmen
|
||||
+---------------------------+-----------------------------------------+-----------------------------+
|
||||
| GOKAPI_AWS_ENDPOINT | Sets the endpoint | eu-central-000.provider.com |
|
||||
+---------------------------+-----------------------------------------+-----------------------------+
|
||||
| GOKAPI_AWS_PROXY_DOWNLOAD | If true, users will not be redirected | true (default:false) |
|
||||
| | | |
|
||||
| | to a pre-signed S3 URL for downloading. | |
|
||||
| | | |
|
||||
| | Instead, Gokapi will download the file | |
|
||||
| | | |
|
||||
| | and proxy it to the user | |
|
||||
+---------------------------+-----------------------------------------+-----------------------------+
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/forceu/gokapi/internal/helper"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// DefaultPort for the webserver
|
||||
@@ -20,7 +19,6 @@ type Environment struct {
|
||||
ConfigFile string `env:"CONFIG_FILE" envDefault:"config.json"`
|
||||
ConfigPath string
|
||||
DataDir string `env:"DATA_DIR" envDefault:"data"`
|
||||
DatabaseUrl string `env:"DATABASE_URL" envDefault:"sqlite://[data]/gokapi.sqlite"`
|
||||
LengthId int `env:"LENGTH_ID" envDefault:"15"`
|
||||
LengthHotlinkId int `env:"LENGTH_HOTLINK_ID" envDefault:"40"`
|
||||
MaxFileSize int `env:"MAX_FILESIZE" envDefault:"102400"` // 102400==100GB
|
||||
@@ -35,7 +33,6 @@ type Environment struct {
|
||||
AwsKeyId string `env:"AWS_KEY"`
|
||||
AwsKeySecret string `env:"AWS_KEY_SECRET"`
|
||||
AwsEndpoint string `env:"AWS_ENDPOINT"`
|
||||
AwsProxyDownload bool `env:"AWS_PROXY_DOWNLOAD" envDefault:"false"`
|
||||
}
|
||||
|
||||
// New parses the env variables
|
||||
@@ -84,12 +81,6 @@ func New() Environment {
|
||||
if result.MaxFileSize < 1 {
|
||||
result.MaxFileSize = 5
|
||||
}
|
||||
|
||||
if flags.IsDatabaseUrlSet {
|
||||
result.DatabaseUrl = flags.DatabaseUrl
|
||||
}
|
||||
result.DatabaseUrl = strings.Replace(result.DatabaseUrl, "[data]", result.DataDir, 1)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@@ -49,12 +49,6 @@ func ParseFlags() MainFlags {
|
||||
Long: "data",
|
||||
Short: "d",
|
||||
})
|
||||
databaseUrlFlagLong := passedFlags.String("database", "", "Sets the data directory. Same as env variable GOKAPI_DATABASE_URL")
|
||||
databaseUrlFlagShort := passedFlags.String("db", "", "alias")
|
||||
aliases = append(aliases, alias{
|
||||
Long: "database",
|
||||
Short: "db",
|
||||
})
|
||||
portFlagLong := passedFlags.Int("port", 0, "Sets the port for setup. Same as env variable GOKAPI_PORT")
|
||||
portFlagShort := passedFlags.Int("p", 0, "alias")
|
||||
aliases = append(aliases, alias{
|
||||
@@ -81,7 +75,6 @@ func ParseFlags() MainFlags {
|
||||
ShowVersion: *versionFlagShort || *versionFlagLong,
|
||||
Reconfigure: *reconfigureFlag,
|
||||
CreateSsl: *createSslFlag,
|
||||
DatabaseUrl: getAliasedString(databaseUrlFlagLong, databaseUrlFlagShort),
|
||||
ConfigPath: getAliasedString(configPathFlagLong, configPathFlagShort),
|
||||
ConfigDir: getAliasedString(configDirFlagLong, configDirFlagShort),
|
||||
DataDir: getAliasedString(dataDirFlagLong, dataDirFlagShort),
|
||||
|
||||
Reference in New Issue
Block a user