Fix env vars and update chart
This commit is contained in:
parent
5ef93fa920
commit
67bd04cafd
17
Dockerfile
17
Dockerfile
|
@ -1,16 +1,23 @@
|
|||
ARG ALPINE_VERSION="3.17"
|
||||
ARG YTDLP_VERSION="2023.03.04"
|
||||
|
||||
FROM alpine:${ALPINE_VERSION}
|
||||
# trunk-ignore(hadolint/DL3007): Chainguard recommends latest
|
||||
FROM cgr.dev/chainguard/static:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apk add --no-cache yt-dlp ffmpeg
|
||||
# Install yt-dlp
|
||||
ARG YTDLP_VERSION=2023.03.04
|
||||
ADD https://github.com/yt-dlp/yt-dlp/releases/download/{YTDLP_VERSION}/yt-dlp /usr/local/bin/
|
||||
|
||||
# Install ffmpeg
|
||||
COPY --from=mwader/static-ffmpeg:6.0 /ffmpeg /usr/local/bin/
|
||||
COPY --from=mwader/static-ffmpeg:6.0 /ffprobe /usr/local/bin/
|
||||
|
||||
COPY ytdl-web ./
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENV YTDL_PORT=8080 \
|
||||
YTDL_LISTEN=0.0.0.0
|
||||
ENV YTDL_HTTP_PORT=8080 \
|
||||
YTDL_HTTP_LISTEN=0.0.0.0
|
||||
|
||||
ENTRYPOINT [ "./ytdl-web" ]
|
|
@ -1,10 +1,10 @@
|
|||
apiVersion: v2
|
||||
description: A web-based frontend for yt-dlp
|
||||
name: ytdl-web
|
||||
version: 1.0.5
|
||||
version: 1.0.6
|
||||
kubeVersion: ">=1.22.0-0"
|
||||
type: application
|
||||
appVersion: 1.0.4
|
||||
appVersion: 1.0.5
|
||||
maintainers:
|
||||
- name: fifitido
|
||||
email: me@fifitido.net
|
||||
|
|
|
@ -10,7 +10,7 @@ env:
|
|||
# YTDL_ENV: Production
|
||||
# YTDL_BINARY_PATH: yt-dlp
|
||||
YTDL_HTTP_LISTEN: 0.0.0.0
|
||||
YTDL_HTTP_PORT: 80
|
||||
YTDL_HTTP_PORT: 8080
|
||||
# YTDL_HTTP_BASEPATH: /example
|
||||
# YTDL_HTTP_TRUSTED_PROXIES: 127.0.0.1 10.0.0.0/8
|
||||
# YTDL_CACHE_TTL: 1h
|
||||
|
@ -22,7 +22,7 @@ service:
|
|||
main:
|
||||
ports:
|
||||
http:
|
||||
port: 80
|
||||
port: 8080
|
||||
|
||||
persistence:
|
||||
config:
|
||||
|
@ -37,5 +37,3 @@ ingress:
|
|||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
service:
|
||||
port: http
|
||||
|
|
|
@ -44,10 +44,10 @@ func init() {
|
|||
|
||||
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $XDG_CONFIG_HOME/ytdl-web/config.yml)")
|
||||
|
||||
rootCmd.PersistentFlags().IntP("port", "p", 8080, "port to listen on")
|
||||
rootCmd.PersistentFlags().StringP("listen", "l", "127.0.0.1", "address to listen on")
|
||||
rootCmd.PersistentFlags().IntP("port", "p", 0, "port to listen on")
|
||||
rootCmd.PersistentFlags().StringP("listen", "l", "", "address to listen on")
|
||||
rootCmd.PersistentFlags().StringP("base-path", "b", "", "the base path, used when behind reverse proxy")
|
||||
rootCmd.PersistentFlags().StringP("ytdlp-path", "y", "yt-dlp", "the path to the yt-dlp binary, used when it is not in $PATH")
|
||||
rootCmd.PersistentFlags().StringP("ytdlp-path", "y", "", "the path to the yt-dlp binary, used when it is not in $PATH")
|
||||
rootCmd.PersistentFlags().BoolP("cookies-enabled", "C", false, "whether cookies are enabled")
|
||||
rootCmd.PersistentFlags().StringP("cookies", "c", "", "the path to the cookies file")
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
|
@ -39,9 +40,9 @@ type ConfigCache struct {
|
|||
}
|
||||
|
||||
type ConfigCookies struct {
|
||||
Enabled bool `mapstructure:"enabled"`
|
||||
FilePath string `mapstructure:"filePath"`
|
||||
FromBrowser *ConfigCookiesFromBrowser `mapstructure:"fromBrowser"`
|
||||
Enabled bool `mapstructure:"enabled"`
|
||||
FilePath string `mapstructure:"filePath"`
|
||||
FromBrowser ConfigCookiesFromBrowser `mapstructure:"fromBrowser"`
|
||||
}
|
||||
|
||||
type ConfigCookiesFromBrowser struct {
|
||||
|
@ -66,7 +67,7 @@ func DefaultConfig() *Config {
|
|||
Cookies: ConfigCookies{
|
||||
Enabled: false,
|
||||
FilePath: "./cookies.txt",
|
||||
FromBrowser: nil,
|
||||
FromBrowser: ConfigCookiesFromBrowser{},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +76,7 @@ func LoadConfig(paths ...string) (*Config, error) {
|
|||
v := viper.New()
|
||||
|
||||
v.SetEnvPrefix("YTDL")
|
||||
v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||
v.AutomaticEnv()
|
||||
|
||||
v.SetConfigName("config")
|
||||
|
@ -92,7 +94,9 @@ func LoadConfig(paths ...string) (*Config, error) {
|
|||
}
|
||||
|
||||
if err := v.ReadInConfig(); err != nil {
|
||||
return nil, err
|
||||
if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
config := DefaultConfig()
|
||||
|
|
|
@ -37,7 +37,7 @@ func (y *ytdlImpl) baseOptions(url string) []Option {
|
|||
}
|
||||
|
||||
if y.cfg.Cookies.Enabled {
|
||||
if y.cfg.Cookies.FromBrowser != nil {
|
||||
if y.cfg.Cookies.FromBrowser.Browser != "" {
|
||||
options = append(options, WithBrowserCookies(
|
||||
y.cfg.Cookies.FromBrowser.Browser,
|
||||
y.cfg.Cookies.FromBrowser.Keyring,
|
||||
|
|
Loading…
Reference in New Issue