Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
darkleaf committed Feb 5, 2025
1 parent f8c97be commit a85b243
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/darkleaf/di/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,15 @@
[registry]
(fn [key]
(?? (when (string? key)
(-> (System/getenv key)
(u/update-description assoc ::kind :env)))
(reify
p/Factory
(dependencies [_])
(build [_ _]
(System/getenv key))
(demolish [_ _])
p/FactoryDescription
(description [_]
{::kind :env})))
(registry key))))

(declare ref template)
Expand Down
8 changes: 8 additions & 0 deletions test/darkleaf/di/tutorial/x_inspect_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
(di/inspect "FOO"))))


(t/deftest fixed-env-test
(t/is (= [(implicit-root "FOO")
{:key "FOO"
:description {::di/kind :trivial
:object "value"}}]
(di/inspect "FOO" {"FOO" "value"}))))


(def variable :obj)

(t/deftest variable-test
Expand Down

0 comments on commit a85b243

Please sign in to comment.