diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9607671 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/_build +/deps +erl_crash.dump +*.ez diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ca588e5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Paul Schoenfelder + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..425e278 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# Conform + +The definition of conform is "Adapt or conform oneself to new or +different conditions". As this library is used to adapt your application +to it's deployed environment, I think it's rather fitting. It's also a +play on the word configuration, and the fact that Conform uses an init-style configuration, maintained in a `.conf` file. + +Conform is a library for Elixir applications, specifically in the +release phase. Elixir already offers a convenient configuration +mechanism via `config/config.exs`, but it has downsides: + +- Configuration is converted to an app.config or sys.config at compile time, which is not useful for applications which require environment-specific configuration, such as app secrets, connection strings, etc. +- Modifying the configuration requires you to recompile your app to regenerate the app.config/sys.config files used by the VM. Alternatively you can modify the sys.config file directly during deployment, using Erlang terms. Neither of these things are ops-friendly, or necessarily accessible to sysadmins who may not understand Elixir or Erlang semantics. +- You can put comments in `config/config.exs`, but once transformed to app.config/sys.config, those comments are lost, leaving sysadmins lost when trying to understand what configuration values are allowed and what they do. + +Conform is intended to fix these problems in the following way: + +- It uses an init-style configuration, which should be very familiar to any sysadmin. +- It is intended to be used during the release process, once your app has been deployed. +- It makes use of the configuration generated by `config/config.exs` as the default configuration, but gives sysadmins an easy way to tune and configure your app in production. +- Conform works by taking `config/schema.exs`, combining the schema with values provided in `config/config.exs`, and generating a `config/myapp.conf` file which can then be modified prior to app startup. The `config/myapp.conf` file is then transformed into the `sys.config` file used by the VM for application configuration. Any documentation provided in `schema.exs` is also displayed in the `myapp.conf` file, so that individuals maintaing the config are able to easily understand the constraints. +- No compilation step required. + +This project is just getting started, but stay tuned for more. This will +be rolled in to exrm in the near future, as soon as this is ready for +production. + diff --git a/lib/conform.ex b/lib/conform.ex new file mode 100644 index 0000000..6e794c0 --- /dev/null +++ b/lib/conform.ex @@ -0,0 +1,2 @@ +defmodule Conform do +end diff --git a/mix.exs b/mix.exs new file mode 100644 index 0000000..ccc41ad --- /dev/null +++ b/mix.exs @@ -0,0 +1,24 @@ +defmodule Conform.Mixfile do + use Mix.Project + + def project do + [app: :conform, + version: "0.0.1", + elixir: "~> 0.13.2-dev", + description: description, + package: package, + deps: deps] + end + + def application do + [applications: []] + end + defp deps, do: [] + defp description, do: "Easy release configuration for Elixir apps." + defp package do + [ files: ["lib", "priv", "mix.exs", "README.md", "LICENSE"], + contributors: ["Paul Schoenfelder"], + licenses: ["MIT"], + links: [ { "GitHub", "https://github.com/bitwalker/conform" } ] ] + end +end diff --git a/test/conform_test.exs b/test/conform_test.exs new file mode 100644 index 0000000..26c91c4 --- /dev/null +++ b/test/conform_test.exs @@ -0,0 +1,7 @@ +defmodule ConformTest do + use ExUnit.Case + + test "the truth" do + assert 1 + 1 == 2 + end +end diff --git a/test/test_helper.exs b/test/test_helper.exs new file mode 100644 index 0000000..4b8b246 --- /dev/null +++ b/test/test_helper.exs @@ -0,0 +1 @@ +ExUnit.start