Skip to content
This repository has been archived by the owner on Apr 7, 2023. It is now read-only.

Latest commit

 

History

History
49 lines (36 loc) · 2.03 KB

README.md

File metadata and controls

49 lines (36 loc) · 2.03 KB

district-server-config

CircleCI

Clojurescript-node.js mount module for a district server, that takes care of loading configuration from a file at system start.

Installation

Add [district0x/district-server-config "1.5.0-SNAPSHOT"] into your project.clj Include [district.server.config] in your CLJS file, where you use mount/start.

Warning: district0x modules are still in early stages, therefore API can change in a future.

Real-world example

To see how district server modules play together in real-world app, you can take a look at NameBazaar server folder, where this is deployed in production.

Usage

You can pass following args to config module:

  • :default Default configuration that will be deep-merged with the one read from a file
  • :env-name Name of ENV variable that stores path to config file. Default: CONFIG
  • :file-path Path to a config file. Default: config.edn, but won't throw error if doesn't exist

Config file is expected to be in EDN format.

(ns my-district
  (:require [mount.core :as mount]
            [district.server.config :refer [config]]))

(-> (mount/with-args
      {:config {:default {:something 1}
                :env-name "DISTRICT_CONFIG"
                ;; Use one of :env-name or :file-path
                :file-path "config.edn"}})
  (mount/start))

(println @config)
;; => {:something 1 :some-other-thing 2}

Development, test & release

  1. Build: npx shadow-cljs compile test-node
  • also need to deploy contracts: npx truffle migrate --network ganache --reset
  1. Tests: node out/node-tests.js

To release (happens automatically on CI at merge to master)

  1. Build: clj -T:build jar
  2. Release: clj -T:build deploy