chensan
I’m in China, we have this so-called great firewall blocking access to some sites.
So we employ some proxies to bypass it, like running
export http_proxy=ip:port;export https_proxy=ip:port
command under my terminal.
After doing that, I would expect HTTPoison to use the proxy ip:port, but obviously it’s not in my test, so I have to pass the proxy option myself:
HTTPoison.get! "https://sites-get-blocked.org", [], [{:proxy, "http://127.0.0.1:8888"}]
My question is, does it respect the system proxy setting? Anyone has a better way to handle a problem like this?
Trending in Questions
Hello everyone!
I am new to coding with Elixir/Erlang. And i am looking for some utilities for fuzzing testing like AFL++.
Does anyone ...
New
I’m very new to Elixir, so sorry if this is a silly question:
I am wondering what happens to the mailbox of a process when the machine i...
New
How do I tell Hologram not to escape HTML when substituting into templates?
{Textile.render(@product.long_description)}
escapes the HTM...
New
Background
When trying to execute mix release on a Windows 11 machine for a Phoenix project I get the following error:
* assembling mark...
New
I load tested a plain Phoenix chat app backed by Postgres with 100 million messages in it, everything on default settings, to see what br...
New
I’d like to create a file with 600 permissions (rw-------), but there’s a race condition if I create it and then change the permissions. ...
New
Is there a way to import record definitions in the iex shell for pretty printing (similar to the rr command in the erl shell)? This woul...
New
Other Trending Topics
Hey there,
I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first.
...
New
Hi everyone :waving_hand:
I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly)
AI dream has many faces, but general...
New
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #code-sync
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #elixirconf-us
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #security
- #elixirconf-eu
- #processes
- #api
- #forms
- #hex










Showing Posts 1 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
NobbZ
Nope, neither HTTPoison nor HTTpotion, nor their underlying erlang libraries do that as far as a quick google turns out. But it should be easy to write a wrapper which looks up the environment variables and then appends the proxy option if it is not already there.
chensan
Yeah, this is what I do at last:
When there’s
proxypresented indev.exs, pass it to HTTPoison.NobbZ
Why don’t you use
System.get_env/1?chensan
Wow, I think it’s much better with
System.get_env, thanks!sriehl
Be careful with using System.get_env/1. It will use the environment variables that are set when your app is compiled. It does not use the environment variables at runtime.
For more info: How to config environment variables with Elixir and Exrm « Plataformatec Blog
gregvaughn
It’s not quite that simple. Well, now that I think about it, it might actually be even simpler than that.
System.get_env/1gets the environment variable at the moment it is executed. Full stop. There’s nothing special about this function doing different things at compile time or run time.The challenge is understanding when it is executed. If used in a module attribute or macro, it gets executed at compile time. If used in a plain function, it gets executed at run time. If put in a
config/*.exsfile, it gets executed when mix executes. And this paragraph is true of any function. It’s nothing specific toSystem.get_env/1NobbZ
We are not talking about using it in
mix.exsorconfig/*.exs, we are talking about having it straight in the application. In a wrapper around another function call.jackalcooper
I think that was because you call it in Elixir’s config file which is consolidated at compile time.