Back

load-properties (clj)

(source)

function

(load-properties {{:keys [env map]} :properties, :as opts})

Examples

migratus
(ns migratus.test.migrations
  (:require
    [clojure.test :refer [deftest is]]
    [migratus.migration.sql :as sql-mig]
    [migratus.migrations :as sut]
    [migratus.properties :as props]
    [migratus.utils :as utils]))

(deftest test-properties
  (is (nil? (props/load-properties {})))
  (is (number? (get (props/load-properties {:properties {}}) "${migratus.timestamp}")))
  (let [props (props/load-properties
                {:properties
                 {:env ["path"]
                  :map {:foo "bar"
                        :baz {:bar "foo"}}}})]
    (is (seq (get props "${path}")))
    (is (= "bar" (get props "${foo}")))
    (is (= "foo" (get props "${baz.bar}")))))
yogthos/migratus
(ns migratus.test.migrations
  (:require
    [clojure.test :refer [deftest is]]
    [migratus.migration.sql :as sql-mig]
    [migratus.migrations :as sut]
    [migratus.properties :as props]
    [migratus.utils :as utils]))

(deftest test-properties
  (is (nil? (props/load-properties {})))
  (is (number? (get (props/load-properties {:properties {}}) "${migratus.timestamp}")))
  (let [props (props/load-properties
                {:properties
                 {:env ["path"]
                  :map {:foo "bar"
                        :baz {:bar "foo"}}}})]
    (is (seq (get props "${path}")))
    (is (= "bar" (get props "${foo}")))
    (is (= "foo" (get props "${baz.bar}")))))