Packages

Simple and secure secrets manager in Elixir projects.

Current section

Files

Jump to
secrex lib mix tasks secrex.encrypt.ex
Raw

lib/mix/tasks/secrex.encrypt.ex

defmodule Mix.Tasks.Secrex.Encrypt do
@moduledoc """
Encrypts secrets to the configured files.
"""
use Mix.Task
import Mix.Secrex
@shortdoc "Encrypts secrets to the configured files"
@impl true
def run(_args) do
key = encryption_key()
for path <- secret_files() do
Mix.shell().info("Encrypting #{path}")
{:ok, encrypted} = encrypt(path, key)
File.write!(encrypted_path(path), encrypted)
end
Mix.shell().info("Files have been encrypted")
end
end