Skip to content

Instantly share code, notes, and snippets.

@korolr
Forked from rlefevre/elm-dmy-fr.md
Created August 14, 2019 12:18
Show Gist options
  • Save korolr/6dfc4695987be6e46233ef67b9c173de to your computer and use it in GitHub Desktop.
Save korolr/6dfc4695987be6e46233ef67b9c173de to your computer and use it in GitHub Desktop.
Elm using elm.dmy.fr proxies

Disclaimer: These proxies and instructions are not from the Elm team. I'm just a community member..


Here is how to use the proxies:

Packages documentation

Two options:

1. Browse elm.dmy.fr instead of package.elm-lang.org

This requires no configuration, but this won't redirect google results or absolute links.

For elm < 0.19, use old.elm.dmy.fr instead.

2. Automatic proxy configuration URL

Configure your system and/or browser proxy with the following proxy automatic configuration URL:

https://elm.dmy.fr/proxy.pac

Or add in your own configuration:

        if (shExpMatch(host, "package.elm-lang.org"))
        {
                return "PROXY elm.dmy.fr:9999";
        }

This will only redirects package.elm-lang.org so performance won't be impacted for other web sites. This should work for all documentation links, including google results.

elm binary

Again two options:

1. https_proxy

$ https_proxy=elm.dmy.fr:9999 elm <command> ...

As the proxy only accepts domains used by the elm binary, don't set it globally, or it could break other programs.

If you don't want to type it each time, wrap the installed elm binary in a shell script found in your $PATH before the the real one. For example if you installed elm with npm:

#!/bin/sh

https_proxy=elm.dmy.fr:9999 ~/.local/bin/elm "$@"

For elm < 0.19, use http_proxy instead:

http_proxy=elm.dmy.fr:9999 elm-make [...]
http_proxy=elm.dmy.fr:9999 elm-package ...

2. Rebuild the elm binary to use the proxy

By rebuilding the binary with a single line modification, you can avoid having to set the https_proxy variable. I won't provide a binary for security and maintenance reasons, but you can use this Dockerfile (using this guide if needed, just changing the Dockerfile) to build an Elm 0.19.0 static Linux x64 one with one command in a few minutes.

Privacy

The proxies log IP addresses to allow to ban some if there are some abuses unrelated to Elm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment