{"id":24568595,"url":"https://github.com/iboard/conion","last_synced_at":"2026-02-19T01:04:37.508Z","repository":{"id":272905365,"uuid":"898715250","full_name":"iboard/conion","owner":"iboard","description":"A general purpose Elixir package with Configuration, Store (Bucket), CentralLogger, and more...","archived":false,"fork":false,"pushed_at":"2025-04-13T04:50:50.000Z","size":83,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-22T11:46:19.172Z","etag":null,"topics":["elixir","elixir-apps"],"latest_commit_sha":null,"homepage":"https://github.com/iboard/conion","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iboard.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-04T22:36:19.000Z","updated_at":"2025-04-13T04:50:53.000Z","dependencies_parsed_at":"2025-04-22T16:51:15.383Z","dependency_job_id":"8d7179b2-1fef-4f47-a9af-4149c433b54a","html_url":"https://github.com/iboard/conion","commit_stats":null,"previous_names":["iboard/cea","iboard/conion"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iboard/conion","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboard%2Fconion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboard%2Fconion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboard%2Fconion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboard%2Fconion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iboard","download_url":"https://codeload.github.com/iboard/conion/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboard%2Fconion/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29600375,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T00:59:38.239Z","status":"ssl_error","status_checked_at":"2026-02-19T00:59:36.936Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","elixir-apps"],"created_at":"2025-01-23T14:41:04.321Z","updated_at":"2026-02-19T01:04:37.481Z","avatar_url":"https://github.com/iboard.png","language":"Elixir","readme":"# Conion\n\n[![.github/workflows/elixir.yml](https://github.com/iboard/conion/actions/workflows/elixir.yml/badge.svg)](https://github.com/iboard/conion/actions/workflows/elixir.yml)\n\nConion is a package containing an Elixir application that provides some \ncommon modules for general tasks in your Elixir application.\n\n**At the moment, this is just a POC. Lets see how mature this application can get.**\n\n### A persistent, supervised key/value store\n- A key/value store (`Conion.Store`) that handles `Conion.Store.Bucket`s\n  - The `Conion.Store.Persistor` is a `Behaviour` that implements `read!` and `write!`\n    for those buckets.\n- Buckets are supervised\n- A central `Conion.Common.Configuration` module to deal with compile and runtime\n  configuration.\n- A central `Conion.Common.CentralLogger` module to do logging in a common manner.\n\n...more to come\n\n## Install and prepare\n\n    git clone https://github.com/iboard/conion.git\n    cd conion\n    mkdir -p data/test data/dev\n    mix test\n    \n## Use it as a dependency in your `mix.exs`\n\n```\n  defp deps do\n    [\n      { :conion, \"~\u003e 0.1\"}\n    ]\n\n```\n\nFind the package on [hex.pm](https://hex.pm/packages/conion)\n\n## Usage Examples\n\nYou can find a complete LiveView application at [Coex](https://github.com/iboard/coex) using\nConion as the backend storage.\n\n### Configuration\n\nDefine the following function in your top module\n\n```\n  def configurations,\n    do: [\n      # { {ENV,      :app,    :key, default}, set-function/1                }\n      {{\"LOG_LEVEL\", :logger, :level, :info}, \u0026Configuration.set_log_level/1}\n    ]\n```\n\nand use it like\n\n```\n  def configure(),\n    do:\n      configurations()\n      |\u003e Enum.reduce(%{}, \u0026Configuration.load_configuration_for/2)\n\n```\n\n### CentralLogger\n\n```\n  use Conion.Common.CentralLogger\n  \n  def .... do \n    log(element_to_log, :warning, \"Any message\" )\n  end\n```\n\n`:warning` is an example for any log-level (:info, :notice, :warning, :error, ...)\nThe `element_to_log` will be \"inspected\" and passed through, thus you can use this\nlog-function in a pipe.\n\n### CommonServer\n\nTo define your GenServers use ...\n\n```\n  use Conion.CommonServer\n  \n  def prepare_state_to_start(args) do\n    # define any term that will be passed to `start_link(__MODULE__, state)` as\n    # the initial state passed to GenServer's `init` function.\n  end\n\n  def initial_state(init_state_from_prepare_function) do\n    # complete the \"loading\", \"initializing\" in the GenServer's init-callback here.\n  end\n\n  # use the `call/2` function to safely call a \"handle_call\" or \"handle_cast\"\n  def bucket_name(pid), do: call(pid, :bucket_name)\n  def persist(bucket), do: cast(process_name(bucket), :persist)\n  \n  # and implement the callbacks as usual\n  def handle_call(:bucket_name, _, state), do: calculate_the_return; {:reply, state[:name], state}\n  def handle_cast(:persist, state), do: do_something; {:noreply, state}\n```\n\n### Store\n\n`Store.Persistor.File` is a simple implementation of the `Store.Persistor` behaviour\nthat writes the data into the given file, using `:erlang.term_to_binary` and reads it back\nusing `:erlang.binary_to_term`\n\nMore implementations of \"persistors\" will follow.\n\n```\nalias CentralScrutinizer.Store\nStore.new_bucket :family, Store.Persistor.File, filename: \"data/dev/family.data\"\n# where `Store.Persistor.File` implements the `Persistor`-behaviour and writes the data to the\n# given file.\n\n{:ok, id_father} = Store.insert_new(:family, %{ name: \"Father\", age: 50})\n{:ok, id_mother} = Store.insert_new(:family, %{ name: \"Mother\", age: 45})\n{:ok, id_child} = Store.insert_new(:family, %{ name: \"Child\", age: 5})\nStore.list(:family)\n# [ {id, %{...}}, {id, %{...}}, ...]\nStore.replace(:family, id_father, %{ name: \"Papa\", age: 51})\nStore.get(:family, id_father) # =\u003e %{ name: \"Papa\", age: 51}\nStore.remove(:family, id_father)\nStore.persist(:family)\n\n```\n\n## Generate an XREF image\n\nto create an xref-graph use the following command:\n\n    mix xref graph --format dot  \u0026\u0026 \\\n    dot -Tpng xref_graph.dot -o xref_graph.png \u0026\u0026 \\\n    open xref_graph.png \u0026\u0026 \\\n    sleep 5 \u0026\u0026 rm xref_graph.*\n\n## Generate documentation\n\n    mix docs \u0026\u0026 open doc/index.html\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiboard%2Fconion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiboard%2Fconion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiboard%2Fconion/lists"}