Skip to content

Conversation

@luciodale
Copy link
Contributor

@luciodale luciodale commented Oct 10, 2019

Usage examples:

From your config.edn:

Serve directory:

...
:ig.system/base
{[:my.project/foo :edge.yada.ig/external-directories]
 {:path "/home/user/target/folder/"
  :options {:custom-suffices [...]
            :index-files [...]
             ...}}
...

And in your edge.bidi.ig/vhost:

["/foo/" #ig/ref [:my.project/foo :edge.yada.ig/external-directories]]

Serve single file:

...
:ig.system/base
{[:my.project/bar :edge.yada.ig/external-files]
 {:path "/home/user/target/folder/file.txt"
  :options {:produces [...]
              ...}}
...

And in your edge.bidi.ig/vhost:

["/file" #ig/ref [:my.project/bar :edge.yada.ig/external-files]]

Copy link
Contributor

@SevereOverfl0w SevereOverfl0w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add docs to doc/resources/doc/sources/built-in-libraries.adoc


(defmethod ig/init-key ::external-directories
[_ {:keys [path options]}]
(yada.resources.file-resource/new-directory-resource
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to require this namespace before using it. See requiring-resolve below.

id
(assoc :id id)))

(defmethod ig/init-key ::external-directories
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe directory-resource is better? Then it can rely on the existing known name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't resource not ideal because the directory won't be on the classpath?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resource would refer to web resource in this context, same as in yada

(yada.resources.file-resource/new-directory-resource
(io/file path) (or options {})))

(defmethod ig/init-key ::external-files
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file-resource is perhaps better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants