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
 | 
					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 ./
 | 
					COPY ytdl-web ./
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXPOSE 8080
 | 
					EXPOSE 8080
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ENV YTDL_PORT=8080 \
 | 
					ENV YTDL_HTTP_PORT=8080 \
 | 
				
			||||||
    YTDL_LISTEN=0.0.0.0
 | 
					    YTDL_HTTP_LISTEN=0.0.0.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ENTRYPOINT [ "./ytdl-web" ]
 | 
					ENTRYPOINT [ "./ytdl-web" ]
 | 
				
			||||||
| 
						 | 
					@ -1,10 +1,10 @@
 | 
				
			||||||
apiVersion: v2
 | 
					apiVersion: v2
 | 
				
			||||||
description: A web-based frontend for yt-dlp
 | 
					description: A web-based frontend for yt-dlp
 | 
				
			||||||
name: ytdl-web
 | 
					name: ytdl-web
 | 
				
			||||||
version: 1.0.5
 | 
					version: 1.0.6
 | 
				
			||||||
kubeVersion: ">=1.22.0-0"
 | 
					kubeVersion: ">=1.22.0-0"
 | 
				
			||||||
type: application
 | 
					type: application
 | 
				
			||||||
appVersion: 1.0.4
 | 
					appVersion: 1.0.5
 | 
				
			||||||
maintainers:
 | 
					maintainers:
 | 
				
			||||||
  - name: fifitido
 | 
					  - name: fifitido
 | 
				
			||||||
    email: me@fifitido.net
 | 
					    email: me@fifitido.net
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,7 +10,7 @@ env:
 | 
				
			||||||
  # YTDL_ENV: Production
 | 
					  # YTDL_ENV: Production
 | 
				
			||||||
  # YTDL_BINARY_PATH: yt-dlp
 | 
					  # YTDL_BINARY_PATH: yt-dlp
 | 
				
			||||||
  YTDL_HTTP_LISTEN: 0.0.0.0
 | 
					  YTDL_HTTP_LISTEN: 0.0.0.0
 | 
				
			||||||
  YTDL_HTTP_PORT: 80
 | 
					  YTDL_HTTP_PORT: 8080
 | 
				
			||||||
  # YTDL_HTTP_BASEPATH: /example
 | 
					  # YTDL_HTTP_BASEPATH: /example
 | 
				
			||||||
  # YTDL_HTTP_TRUSTED_PROXIES: 127.0.0.1 10.0.0.0/8
 | 
					  # YTDL_HTTP_TRUSTED_PROXIES: 127.0.0.1 10.0.0.0/8
 | 
				
			||||||
  # YTDL_CACHE_TTL: 1h
 | 
					  # YTDL_CACHE_TTL: 1h
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,7 @@ service:
 | 
				
			||||||
  main:
 | 
					  main:
 | 
				
			||||||
    ports:
 | 
					    ports:
 | 
				
			||||||
      http:
 | 
					      http:
 | 
				
			||||||
        port: 80
 | 
					        port: 8080
 | 
				
			||||||
 | 
					
 | 
				
			||||||
persistence:
 | 
					persistence:
 | 
				
			||||||
  config:
 | 
					  config:
 | 
				
			||||||
| 
						 | 
					@ -37,5 +37,3 @@ ingress:
 | 
				
			||||||
        paths:
 | 
					        paths:
 | 
				
			||||||
          - path: /
 | 
					          - path: /
 | 
				
			||||||
            pathType: Prefix
 | 
					            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().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().IntP("port", "p", 0, "port to listen on")
 | 
				
			||||||
	rootCmd.PersistentFlags().StringP("listen", "l", "127.0.0.1", "address 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("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().BoolP("cookies-enabled", "C", false, "whether cookies are enabled")
 | 
				
			||||||
	rootCmd.PersistentFlags().StringP("cookies", "c", "", "the path to the cookies file")
 | 
						rootCmd.PersistentFlags().StringP("cookies", "c", "", "the path to the cookies file")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
package config
 | 
					package config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"strings"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/spf13/viper"
 | 
						"github.com/spf13/viper"
 | 
				
			||||||
| 
						 | 
					@ -41,7 +42,7 @@ type ConfigCache struct {
 | 
				
			||||||
type ConfigCookies struct {
 | 
					type ConfigCookies struct {
 | 
				
			||||||
	Enabled     bool                     `mapstructure:"enabled"`
 | 
						Enabled     bool                     `mapstructure:"enabled"`
 | 
				
			||||||
	FilePath    string                   `mapstructure:"filePath"`
 | 
						FilePath    string                   `mapstructure:"filePath"`
 | 
				
			||||||
	FromBrowser *ConfigCookiesFromBrowser `mapstructure:"fromBrowser"`
 | 
						FromBrowser ConfigCookiesFromBrowser `mapstructure:"fromBrowser"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ConfigCookiesFromBrowser struct {
 | 
					type ConfigCookiesFromBrowser struct {
 | 
				
			||||||
| 
						 | 
					@ -66,7 +67,7 @@ func DefaultConfig() *Config {
 | 
				
			||||||
		Cookies: ConfigCookies{
 | 
							Cookies: ConfigCookies{
 | 
				
			||||||
			Enabled:     false,
 | 
								Enabled:     false,
 | 
				
			||||||
			FilePath:    "./cookies.txt",
 | 
								FilePath:    "./cookies.txt",
 | 
				
			||||||
			FromBrowser: nil,
 | 
								FromBrowser: ConfigCookiesFromBrowser{},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -75,6 +76,7 @@ func LoadConfig(paths ...string) (*Config, error) {
 | 
				
			||||||
	v := viper.New()
 | 
						v := viper.New()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	v.SetEnvPrefix("YTDL")
 | 
						v.SetEnvPrefix("YTDL")
 | 
				
			||||||
 | 
						v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
 | 
				
			||||||
	v.AutomaticEnv()
 | 
						v.AutomaticEnv()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	v.SetConfigName("config")
 | 
						v.SetConfigName("config")
 | 
				
			||||||
| 
						 | 
					@ -92,8 +94,10 @@ func LoadConfig(paths ...string) (*Config, error) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err := v.ReadInConfig(); err != nil {
 | 
						if err := v.ReadInConfig(); err != nil {
 | 
				
			||||||
 | 
							if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	config := DefaultConfig()
 | 
						config := DefaultConfig()
 | 
				
			||||||
	if err := v.Unmarshal(config); err != nil {
 | 
						if err := v.Unmarshal(config); err != nil {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,7 +37,7 @@ func (y *ytdlImpl) baseOptions(url string) []Option {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if y.cfg.Cookies.Enabled {
 | 
						if y.cfg.Cookies.Enabled {
 | 
				
			||||||
		if y.cfg.Cookies.FromBrowser != nil {
 | 
							if y.cfg.Cookies.FromBrowser.Browser != "" {
 | 
				
			||||||
			options = append(options, WithBrowserCookies(
 | 
								options = append(options, WithBrowserCookies(
 | 
				
			||||||
				y.cfg.Cookies.FromBrowser.Browser,
 | 
									y.cfg.Cookies.FromBrowser.Browser,
 | 
				
			||||||
				y.cfg.Cookies.FromBrowser.Keyring,
 | 
									y.cfg.Cookies.FromBrowser.Keyring,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue