This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # aws-lambda (1)
- # babashka (3)
- # beginners (97)
- # cider (20)
- # clojure (9)
- # clojure-spec (8)
- # clojure-uk (9)
- # clojurescript (25)
- # core-async (2)
- # cryogen (7)
- # cursive (4)
- # fulcro (9)
- # graalvm (14)
- # graphql (8)
- # luminus (2)
- # off-topic (18)
- # pathom (3)
- # re-frame (1)
- # reagent (4)
- # shadow-cljs (36)
- # spacemacs (1)
- # vscode (2)
I would like to generate a site with
:blog-prefix set to either
/test-blog , depending on whether I am generating the static site for the live website or the test environment. This setting affects the Continue Reading links on the main page when
:preview? true is set.
Is it possible to use a different
content/config.edn when calling
lein run to generate the static site? For example, having a
content/config-test.edn to configure the test environment?
I am using GitHub project (not user or org, they are already used) to host a cryogen blog and everything works great for one environment. I created a second GitHub repository and deployment works, but the continue reading links on the main page either go to the live website or get a 404 if the article is only on the test site.
I am looking at the http://cryogenweb.org/docs/configuration.html section for ideas, but there isnt an obvious (to me) way of doing this, without investigating the Cryogen source code more deeply. Am I missing something obvious?
I found a solution. If I add a
config-file argument to the
-main function in
src/cryogen/core.clj and use that a a way of specifying an overrides file, then I can call
lein run content/config-test.edn or
lein run content/config.edn depending on if I want the test site or live site.
(defn -main [config-file] (load-plugins) (compile-assets-timed (read-string (slurp config-file))) (System/exit 0))
I am assuming the
src/cryogen/server.clj is used by the command
lein ring server and not
lein run and so I wont need to change that file as I always want that to be using just the
If there is a better approach, I would be interested to hear. Otherwise I'll write this up for an article on my blog in a week or two and share that link here.
@jr0cket that sounds like the right approach. I guess you're passing the contents of the config to the compiler in order to override the default config then? Sort of like what the docs describe in the configuration section:
If you want to override or extend config.edn from code, (e.g. by reading environment variables or by using an untracked file) you can edit src/cryogen/core.clj and src/cryogen/server.clj to pass a clojure map to the compile-assets-timed function.
Yes, I just followed what the docs were saying, with the addition of changing
-main to take a config hash-map, so I could then choose to override the default (live) config.
Ideally I should make the argument optional, and test for the argument, so I only have to provide a config hash-map when generating a test site