FileStore.Config (file_store v0.2.1)

Define a configurable store.

Usage

First, define a new module:

defmodule MyApp.Storage do
  use FileStore.Config, otp_app: :my_app
end

In your config files, you'll need to configure your adapter:

config :my_app, MyApp.Storage,
  adapter: FileStore.Adapters.Null

If you need to dynamically configure your store at runtime, you can implement the init/1 callback.

def init(opts) do
  Keyword.put(opts, :foo, "bar")
end

Example

iex> MyApp.Storage.write("foo", "hello world")
:ok

iex> MyApp.Storage.read("foo")
{:ok, "hello world"}