Storing encrypted configuration in your git repo with DotenvSekrets

Developers who are familiar with the “twelve-factor” app know that configuration should be stored in the environment (loaded via env vars), not in the code. If you’re writing a Rails application you may want to use the dotenv gem, which allows you to store env variable in a handy series of files such as .env, .env.development, .env.test and so on. You can read the gem readme for all the details.

Since configuration varies with time and you may be working with many other developers, it is quite handy to store these env files in your git repository, but there’s a big caveat: you should not store passwords, secrets and tokens inside a git repo for security reasons, unless they’re encrypted.

Continue reading “Storing encrypted configuration in your git repo with DotenvSekrets”

Testing HTTP in Elixir with ExVCR

Studying Elixir, I decided to write a client for an existing API and I wanted to do it in the correct way™: writing a complete test coverage.
My choice was to use HTTPoison (since I like Poison for JSON parsing) and ExVCR to write the API tests.

So, what is ExVCR? If you come from the Rails land, it’s the Elixir version of VCR, it:
“Record and replay HTTP interactions library for elixir. It’s inspired by Ruby’s VCR, and trying to provide similar functionalities.”
It allows you to make API calls and record those on “cassettes”, allowing you to replay the recordings at every test run, decoupling the test phase from the API server and permitting offline tests.

Continue reading “Testing HTTP in Elixir with ExVCR”

LambdaDays 2017, FP concepts and their application

In my last post I tried to summarize the main concepts expressed by Prof. John Hughes and Prof. Mary Sheeran in their wonderful keynote at the LambdaDays 2017.

If you didn’t read it, well, here it is. Go on, I’ll be waiting for you here 😁

…done?

Jokes apart, at the end of my summary I left a little bit of suspense regarding the topics of my next (this) post but I also gave a few hints about them.

So, without further ado, here there are the two “mysterious concepts”:

Continue reading “LambdaDays 2017, FP concepts and their application”

Previewing email in Rails with ActionMailer::Preview and Letter Opener

Developing email templates to be sent by our Rails application may sometimes be a long and tedious operation because under development you must continuously send to yourself the email in order to test the changes.

If you don’t want to waste your time, Rails provides a very helpful tool for those who need to build the layout for the emails of our application: ActionMailer::Preview. In fact, with this tool (available from Rails 4.1), you are able to generate the Rails mailer view without the need to actually send the email.
Continue reading “Previewing email in Rails with ActionMailer::Preview and Letter Opener”

LambdaDays 2017 – more than one month later…

I know, I should have written this article a while ago but I couldn’t find the time…sorry 😞

Anyway…one month…how time flies!

Last February, thanks to 😘 Mikamai, I had the immense pleasure to attend to an astonishing conf.

For the ones who don’t know, LambdaDays is an international 2 days conference that has been held in Krakow for four years now.

Its main focus is the “umbrella topic” of “Functional Programming”.

Continue reading “LambdaDays 2017 – more than one month later…”