Skip to content

Commit

Permalink
Mainly documenting the configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-brooke committed Feb 11, 2020
1 parent ba45ea5 commit fc4dcdb
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 46 deletions.
11 changes: 7 additions & 4 deletions resources/config.edn
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,25 @@
;; ; ; ; ; ; ; ; ; ;
{
:content-dir "resources/public/content"
:start-page "Introduction"
;; where content is served from.
:default-locale "en-GB" ;; default language used for messages
:formatters {"vega" smeagol.formatting/process-vega
:formatters ;; formatters for processing markdown
;; extensions.
{"vega" smeagol.formatting/process-vega
"vis" smeagol.formatting/process-vega
"mermaid" smeagol.extensions.mermaid/process-mermaid
"backticks" smeagol.formatting/process-backticks
"pswp" smeagol.formatting/process-photoswipe}
:log-level :info ;; the minimum logging level; one of
;; :trace :debug :info :warn :error :fatal
:js-from :cloudflare ;; where to load JavaScript libraries
;; from: options are :local, :cloudflare
:js-from :cdnjs ;; where to load JavaScript libraries
;; from: options are :local, :cdnjs
:passwd "resources/passwd"
;; where the password file is stored
:site-title "Smeagol" ;; overall title of the site, used in
;; page headings
:start-page "Introduction" ;; the page shown to a visitor to the
;; root URL.
:thumbnails {:small 64 ;; maximum dimension of thumbnails
;; stored in the /small directory
:med 400 ;; maximum dimension of thumbnails
Expand Down
33 changes: 0 additions & 33 deletions resources/public/content/Configuration.md

This file was deleted.

102 changes: 102 additions & 0 deletions resources/public/content/Configuring Smeagol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
Smeagol's core configuration comes from a configuration file, `config.edn`, which may be overridden by [[Environment Variables]]. The default file is at `resources/config.edn`; this default can be overridden by providing an environment variable, `SMEAGOL_CONFIG`, whose value is the full or relative pathname of a suitable file.


The default configuration file is as follows:

```
{
:content-dir "resources/public/content"
;; where content is served from.
:default-locale "en-GB" ;; default language used for messages
:formatters ;; formatters for processing markdown
;; extensions.
{"vega" smeagol.formatting/process-vega
"vis" smeagol.formatting/process-vega
"mermaid" smeagol.extensions.mermaid/process-mermaid
"backticks" smeagol.formatting/process-backticks
"pswp" smeagol.formatting/process-photoswipe}
:log-level :info ;; the minimum logging level; one of
;; :trace :debug :info :warn :error :fatal
:js-from :cdnjs ;; where to load JavaScript libraries
;; from: options are :local, :cdnjs
:passwd "resources/passwd"
;; where the password file is stored
:site-title "Smeagol" ;; overall title of the site, used in
;; page headings
:start-page "Introduction" ;; the page shown to a visitor to the
;; root URL.
:thumbnails {:small 64 ;; maximum dimension of thumbnails
;; stored in the /small directory
:med 400 ;; maximum dimension of thumbnails
;; stored in the /med directory
}}
```


## content-dir

The value of `content-dir` should be the full or relative path to the content to be served: the Markdown files, and the upload directories. Full paths are advised, where possible. The directory must be readable and writable by the process running Smeagol. The default is `resources/public/conten`


The value from the configuration file may be overridden with the value of the environment variable `SMEAGOL_CONTENT_DIR`.


## default-locale

The locale which you expect the majority of your visitors will use. Content negotiation will be done of course, and the best internationalisation file available will be used, but this sets a default for users who do not have any acceptable locale known to us. The default value is `en-GB`.


This parameter may be overridden with the environment variable `SMEAGOL-DEFAULT-LOCALE`.


## formatters

Specifications for formatters for markup extensions. The exact data stored will change before Smeagol 1.1.0. TODO: update this.


## log-level

The level at which logging should operate. Each setting implies all of the settings more severe than itself so


1. setting `:debug` will log all of `debug, info, warn, error` and| `fatal` messages;

2. setting `:info` will log all of `info, warn, error` and| `fatal` messages;


and so on, so that setting `:fatal` will show only messages which report reasons for Smeagol to fail.


The default setting is `:info`.


This parameter may be overridden with the environment variable `SMEAGOL-LOG-LEVEL`.

## TODO: Complete this doumentation!
2 changes: 1 addition & 1 deletion resources/public/content/Docker Image.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Where 127.0.0.1 is the IP address through which you want to forward port 80 (in

You can then browse to Smeagol by pointing your browser at http://localhost/.

As of version 0.99.10, the Docker image is now based on the Jetty, rather than the Tomcat, deployment of Smeagol (that is to say, it runs the executable jar file). This makes for a lighter weight Docker image. All configuration can be overridden with [[Environment Variables]], which can be passed into the Docker container when the image is invoked, or from a [[Configuration]] file.
As of version 0.99.10, the Docker image is now based on the Jetty, rather than the Tomcat, deployment of Smeagol (that is to say, it runs the executable jar file). This makes for a lighter weight Docker image. All configuration can be overridden with [[Environment Variables]], which can be passed into the Docker container when the image is invoked, or from a Configuration file, see [[Configuring Smeagol]].

The `config.edn` and `passwd` files and the `content` directory are copied into `/usr/local/etc` in the Docker image, and the appropriate environment variables are set up to point to them:
```
Expand Down
2 changes: 1 addition & 1 deletion resources/public/content/User Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ To upload a file (including an image file), select the link `Upload a file` from

Selecting the link will take you to the `Upload a file` page. This will prompt you for the file you wish to upload. Select your file, and then select the green `Save!` button.

After your file has uploaded, you will be shown a link which can be copied and pasted into a Wiki page to link to that file.
After your file has uploaded, you will be shown a link which can be copied and pasted into a Wiki page to link to that file. When you upload a PNG or JPG image file, multiple copies of the file may be saved at different resolutions, and you will be shown links to each of these. The `Upload a file` form also has a link to the list of all files which have been uploaded, to help with finding the one you're looking for!

You must be logged in to upload files.

Expand Down
1 change: 1 addition & 0 deletions resources/public/content/_side-bar.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
* [[Introduction]]
* [[Change log]]
* [[User Documentation]]
* [[Configuring Smeagol]]
* [[Deploying Smeagol]]
* [[Developing Smeagol]]

Expand Down
8 changes: 4 additions & 4 deletions resources/templates/wiki.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

{% block extra-headers %}
<!-- ifequal js-from ":cloudflare" -->
{% script "https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe-ui-default.min.js" %}
{% script "https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe.min.js" %}
{% style "vendor/node_modules/photoswipe/dist/photoswipe.css" %}
{% style "vendor/node_modules/photoswipe/dist/default-skin/default-skin.css" %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe-ui-default.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe.min.js"></script>
{% style "/vendor/node_modules/photoswipe/dist/photoswipe.css" %}
{% style "/vendor/node_modules/photoswipe/dist/default-skin/default-skin.css" %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/8.4.6/mermaid.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vega/5.9.1/vega.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vega-lite/4.1.1/vega-lite.min.js"></script>
Expand Down
7 changes: 4 additions & 3 deletions src/smeagol/routes/wiki.clj
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,13 @@
uploaded (if upload (ul/store-upload params data-path))
user (session/get :user)
summary (format "%s: %s" user (or (:summary params) "no summary"))]
;; (if
;; uploaded
;; TODO: Get this working! it MUST work!
;; (if-not
;; (empty? uploaded)
;; (do
;; (map
;; #(git/git-add git-repo (str :resource %))
;; uploaded)
;; (remove nil? uploaded))
;; (git/git-commit git-repo summary {:name user :email (auth/get-email user)})))
(layout/render "upload.html"
(merge (util/standard-params request)
Expand Down

0 comments on commit fc4dcdb

Please sign in to comment.