Skip to content

Commit c416227

Browse files
committed
Add section on Includes
1 parent c18feeb commit c416227

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

index.adoc

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,47 @@ For more information on the multimethods that can be used, refer to the
542542
https://github.com/weavejester/integrant/blob/master/README.md[Integrant
543543
documentation].
544544

545+
=== Includes
546+
547+
As a configuration grows, it may become useful to split it up into
548+
several smaller files. We can do this via the `#duct/include` reader
549+
tag.
550+
551+
If you tag a filepath string with `#duct/include`, it indicates to Duct
552+
that it should replace the tagged string with the corresponding edn
553+
file. You can place this anywhere in the your `duct.edn` configuration.
554+
555+
For example, suppose we want to factor out all of the vars into their
556+
own configuration file, and also have a separate configuration for the
557+
'`hello`' component.
558+
559+
.duct.edn
560+
[,clojure]
561+
----
562+
{:vars #duct/include "vars.edn"
563+
:system
564+
{:duct.module/logging {}
565+
:tutorial.print/hello #duct.include "hello.edn"}}
566+
----
567+
568+
.vars.edn
569+
[,clojure]
570+
----
571+
{name {:arg name, :env NAME, :type :str, :default "World"
572+
:doc "The name of the person to greet"}}
573+
----
574+
575+
.hello.edn
576+
[,clojure]
577+
----
578+
{:logger #ig/ref :duct/logger
579+
:level #ig/profile {:repl :report, :main :info}
580+
:name #ig/var name}
581+
----
582+
583+
The path of the includes is always relative to the root configuration
584+
file -- in this case, `duct.edn`.
585+
545586
== Web Applications
546587

547588
While Duct can be used for any server-side application, its most common

0 commit comments

Comments
 (0)