How does LT_GET_API_KEY_LINK work?

It looks to me that whatever value I enter for LT_GET_API_KEY_LINK= it just gets appended to my base URL.

I’m trying to have a simple mailto: link as the value for LT_GET_API_KEY_LINK= but am struggling to get that working as something like
<a href="mailto:[email protected]?subject=Request for API key">Request API</a> just gets stuck onto the base url resulting in
i,.e. https://translate.mydomain.tld/<a href="mailto:[email protected]?subject=Request for API key">Request API</a>

You cannot use HTML tags; just use “mailto:…”.

Using this:
LT_GET_API_KEY_LINK="mailto:[email protected]?subject=request for translation API key"

leads to this result:
https://translate.domain.tld/%22mailto:[email protected]?subject=request%20for%20translation%20API%20key%22

Do I need to escape some characters?

There should be no need to escape characters.

I tried it on my machine and works correctly (?)

Please share more information about how you’re running / starting the program, and if you’ve modified anything else?

I will reply in multiple answers as I have LibreTranslate on autoupdate via watchtower and its gone haywire since the update last night.

This is what it looks like. I will first go back to v1.3.7 and the reply again.

OK, downgraded to version v.1.3.7 and all is working fine again except for the mailto link. I will share my compose file just now.

Here is my docker-compose.yml file

version: "2.4"                                                                                                                                       
# documentation for i.e. ENV variables                                                                                                               
# https://registry.hub.docker.com/r/libretranslate/libretranslate                                                                                    
# https://github.com/LibreTranslate/LibreTranslate                                                                                                   
# https://community.libretranslate.com/t/im-wondering-why-the-docker-image-is-3-7-gb/391                                                             
                                                                                                                                                     
services:                                                                                                                                            
  libretranslate:                                                                                                                                    
    image: libretranslate/libretranslate:v1.3.7                                                                                                      
    container_name: libretranslate                                                                                                                   
    hostname: libretranslate                                                                                                                         
    restart: "no"                                                                                                                                    
    environment:                                                                                                                                     
      - LT_DEBUG=false                                                                                                                               
      - LT_FRONTEND_LANGUAGE_SOURCE=de                                                                                                               
      - LT_FRONTEND_LANGUAGE_TARGET=en                                                                                                               
      - LT_LOAD_ONLY='de,en,fr,it,es'                                                                                                                
      - LT_THREADS=4                                                                                                                                 
#      LT_UPDATE_MODELS: true                                                                                                                        
      - LT_SUGGESTIONS=true                                                                                                                          
      - LT_API_KEYS=true                                                                                                                             
      - LT_REQUIRE_API_KEY_ORIGIN="translate.mydomain.tld"                                                                                              
      - LT_REQ_LIMIT=30                                                                                                                              
      - LT_GET_API_KEY_LINK="mailto:[email protected]?subject=request for translation API key"                                                        
                                                                                                                                                                                                                                            
    volumes:                                                                                                                                         
      - ./data/db:/app/db                                                                                                                            
      - ./data/argos-translate:/home/libretranslate/.local/share/argos-translate                                                                     
    networks:                                                                                                                                        
      - libretranslate                                                                                                                               
      - traefik                                                                                                                                      
    cpus: 2                                                                                                                                          
    mem_limit: 4G                                                                                                                                    
    labels:                                                                                                                                          
      - "traefik.enable=true"                                                                                                                        
      - "traefik.docker.network=traefik"                                                                                                             
      - "traefik.http.routers.libretranslate.tls=true"                                                                                               
      - "traefik.http.routers.libretranslate.entrypoints=websecure"                                                                                  
      - "traefik.http.routers.libretranslate.rule=Host(`translate.mydomain.tld`)"                                                                       
      - "traefik.http.routers.libretranslate.middlewares=secHeaders@file"                                                                            
      - "traefik.http.routers.libretranslate.service=libretranslate"                                                                                 
      - "traefik.http.services.libretranslate.loadbalancer.server.port=5000"                                                                         
                                                                                                                                                     
networks:                                                                                                                                            
  libretranslate:                                                                                                                                    
    external: true                                                                                                                                   
    name: libretranslate                                                                                                                             
  traefik:                                                                                                                                           
    external: true                                                                                                                                   
    name: traefik

Mm, I’m out of ideas :face_with_monocle:

Setting both LT_REQUIRE_API_KEY_ORIGIN and LT_GET_API_KEY_LINK to match the provided configuration seems to work fine with the latest version (on my machine at least).

So you did not spot anything wrong with my compose file?

EDIT:
this worked, no ‘’ or “” around the variable
LT_GET_API_KEY_LINK=mailto:[email protected]?subject=request for translation API key

basically the only remaining problem is that even though I have set:
- LT_REQUIRE_API_KEY_ORIGIN=translate.mydomain.tld

my self hosted LT instance (behind a reverse proxy) still needs an api key - I had understood that this parameter would allow usage of the website functions without an api key or did I misunderstand this variable?

Maybe your proxy is overriding the Origin header.

Thanks for your support. i tried debugging it but got no better results. Let’s leave this here, maybe one day somebody comes along who’s more knowledgeable than me and also uses traefik :slight_smile:

I guess I’ll have to live with inputting an api key on my own LT isntance