diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2023-01-06 00:04:28 -0500 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2023-01-06 00:04:28 -0500 |
| commit | 1d01acca36b78eeba99da1adb10e72d186433b39 (patch) | |
| tree | d44fd6268ee26af16acfe720abbd2b3a2e6e5574 /readme.md | |
| parent | ad769c34b2f03bffe2c84a8872331838a80c2870 (diff) | |
| download | go-website-1d01acca36b78eeba99da1adb10e72d186433b39.tar.gz go-website-1d01acca36b78eeba99da1adb10e72d186433b39.tar.xz | |
Update site to server configuration via environment variables. Add a genhash command. Update docs.
Diffstat (limited to 'readme.md')
| -rw-r--r-- | readme.md | 56 |
1 files changed, 37 insertions, 19 deletions
@@ -7,15 +7,24 @@ Entirely driven by the filesystem there's a special markdown format that lets you set some variables in yaml at the top and the rest of the page body in markdown for the rest. -It's designed to be somewhat easy to use by an intelligent lay person, once the website is setup most pages can be edited from the dashboard once the user is logged in. +It's designed to be somewhat easy to use by an intelligent lay person, once the +website is setup most pages can be edited from the dashboard once the user is +logged in. -Multiple users can be specified in the `auth.json` file. No `auth.json` file is required, the program will create and save one automatically when it first runs. Just be aware that the username/password defaults to admin admin. +Multiple users can be specified in the `auth.json` file. No `auth.json` file is +required, the program will create and save one automatically when it first runs. +Just be aware that the username/password defaults to admin admin. -If you set a password clear text in `auth.json` it will be rewritten as the hash alone when the program is run. +You can generate password hashes with the `-genhash` flag, it will prompt +you to input your password and it will spit out a hash. + +If you set a password clear text in `auth.json` it will be rewritten as the hash +alone when the program is run. It's not recommended, but offered as a +convenience. If you wish to use a file other than `auth.json` you can specify one from the command line flags. -There's an exmaple website in `example-site` +There's an example website in `example-site` Additionally it's designed to handle a large amount of requests by caching the output of the templates in redis rather than rendering them dynamically on each @@ -62,7 +71,10 @@ The only runtime requirements for the website are the website directory and the ## Example git hook for automatically updating a production website -Say you're like me and like editing your website from a command line editor and commiting each change. Well, it's easy enough to deploy your changes to your production website with a simple `git push`, simply clone the repository on your remote server and add this `post-receive` hook: +Say you're like me and like editing your website from a command line editor and +committing each change. Well, it's easy enough to deploy your changes to your +production website with a simple `git push`, simply clone the repository on your +remote server and add this `post-receive` hook: ```bash #!/bin/sh @@ -82,7 +94,9 @@ Then on your local copy: `$ git remote add production myProductionServer.example.com:/path/to/checkout/on/disk` -Now, when you run `git push production master` the `myProductionServer.example.com` machine will automatically update the git repository and clear the redis cache, in this case for `example.com` +Now, when you run `git push production master` the +`myProductionServer.example.com` machine will automatically update the git +repository and clear the redis cache, in this case for `example.com` ## Help output from `server` @@ -93,26 +107,30 @@ The options most people will be interested in are `-l`, `-d`, `-r`, `-c` and `-a $ ./server -h Usage of Website: -T string - Set the page time format, be careful with this (default "01.02.2006 15:04:05 MST") - -V Be more verbose ( dump config, etc ) + Override the default format used to parse page time. Be careful. (Environ: 'TIME_FORMAT') (default "01.02.2006 15:04:05 MST") + -V Be more verbose, dump config and such (Environ: 'VERBOSE') -ac string - Location for authorization configuration file (default "auth.json") + location for the authorization config (Environ: 'AUTH_CONFIG') (default "auth.json") -c string - Location for the config file (default "conf.yml") + Location for configuration file (Environ: 'CONFIG_FILE') (default "conf.yml") -cache-index - If set to false do not cache index (default true) + If set to false, do not cache the page index (Environ: 'CACHE_INDEX') (default true) -d string - Directory to serve. (default ".") + Website directory to serve (Environ: 'SITE_DIR') (default ".") + -genhash + If set to true, interactively generate a password hash (Environ: 'INTERACTIVE_HASH_GEN') -i string - Path in which, when called will rebuild the index and clear the cache (default "/reIndex") + Path in which, when called will rebuild the index and clear the cache (Environ: 'INDEX_PATH') (default "/reIndex") -l string - Listening address (default "0.0.0.0:8001") + listening address (Environ: 'LISTEN_ADDR') (default ":8001") -r string - Redis server set to "" to disable (default "127.0.0.1:6379") + Redis server set to "" to disable (Environ: 'REDIS_ADDR') (default "127.0.0.1:6379") -rk string - Redis key to use for storing cached pages (default "go-website") + Redis key to use for storing cached pages (Environ: 'REDIS_KEY') (default "go-website") -timeout int - Seconds until page timeout for read and write (default 15) - -v Print the version then exit - + Seconds until page timeout for read and write (Environ: 'HTTP_TIMEOUT') (default 15) + -v print version and exit (Environ: 'PRINT_VERSION_AND_EXIT') +$ ``` + +Environment variables listed above can be used in lieu of the flags. |
