diff --git a/root/defaults/config.default.js b/root/defaults/config.default.js index 759a560..98c11d1 100644 --- a/root/defaults/config.default.js +++ b/root/defaults/config.default.js @@ -1,21 +1,48 @@ -'use strict'; - // Modules var path = require('path'); -var config = { +// Which Theme to Use? +// +// Local Directory Example (for development or custom themes) +// var theme_dir = path.join(__dirname, 'themes'); +// var theme_name = 'my-theme-directory'; +// +// Themes from NPM +// use "dist" as the theme name for modules (for now) +var theme_dir = path.join( + __dirname, + '..', + 'node_modules', + '@raneto/theme-default' +); +var theme_name = 'dist'; +var config = { // Your site title (format: page_title - site_title) site_title: 'Raneto Docs', // The base URL of your site (can use %base_url% in Markdown files) + // This should be the full path to your Raneto installation: + // example 1: https://raneto.mydomain.com + // example 2: https://www.mydomain.com/raneto + // Do not include a trailing "/" + // Leave this as an empty string to use the default base_url: '', + nowrap: true, + + // Path Prefix + // If you are running Raneto on a subpath of your domain, add it here + // Leave it blank if you are not sure + // + // Example: if you are running Raneto at http://www.mydomain.com/raneto + // then you would enter '/raneto' below + path_prefix: '', // Used for the "Get in touch" page footer link support_email: '', // Footer Text / Copyright - copyright: 'Copyright © ' + new Date().getFullYear() + ' - Powered by Raneto', + copyright: `Copyright © ${new Date().getFullYear()} - Powered by Raneto`, // Excerpt length (used in search) excerpt_length: 400, @@ -32,8 +59,11 @@ var config = { // all categories or files that do not specify ShowOnHome meta property will be shown show_on_home_default: true, + // Theme (see top of file) + theme_dir, + theme_name, + // Specify the path of your content folder where all your '.md' files are located - // Fix: Needs trailing slash for now! // Fix: Cannot be an absolute path content_dir : '/config/content/', @@ -49,10 +79,10 @@ var config = { analytics: '', // Set to true to enable the web editor - allow_editing : true, + allow_editing: true, // Set to true to enable HTTP Basic Authentication - authentication : true, + authentication: true, // If editing is enabled, set this to true to only authenticate for editing, not for viewing authentication_for_edit: true, @@ -62,19 +92,36 @@ var config = { // Google OAuth googleoauth: false, - oauth2 : { + google_group_restriction: { + enabled: false, + api_key: 'GOOGLE_API_KEY', + group_name: 'GOOGLE_GROUP_NAME', + }, + oauth2: { client_id: 'GOOGLE_CLIENT_ID', client_secret: 'GOOGLE_CLIENT_SECRET', callback: 'http://localhost:3000/auth/google/callback', - hostedDomain: 'google.com' + hostedDomain: 'google.com', }, secret: 'someCoolSecretRightHere', - credentials : [ + // ##### WARNING ##### + // You MUST change the username and password for security + // Do NOT use "admin" as a username as it's easily guessed. + // You are encouraged to use tools to generate a password + // Preferably, use a local password manager + // If you absolutely must use an online tool, here are some suggestions + // https://bitwarden.com/password-generator/ + // https://www.grc.com/passwords.htm + credentials: [ { - username : 'admin', - password : 'password' - } + username: 'admin', + password: 'password', + }, + { + username: 'admin2', + password: 'password', + }, ], locale: 'en', @@ -89,7 +136,7 @@ var config = { rtl_layout: false, // Edit Home Page title, description, etc. - home_meta : { + home_meta: { // title : 'Custom Home Title', // description : 'Custom Home Description' }, @@ -105,8 +152,18 @@ var config = { // } // ] - table_of_contents: false + // Set to true to enable generation of table of contents + table_of_contents: false, + // Configure generation of table of contents (see markdown-toc's docs for details on available options) + table_of_contents_options: { + // append: 'Table of contents appendix', + // maxdepth: 6, + // firsth1: true, + }, + + menu_on_pages: true, + menu_on_page_collapsible: true, }; config.public_dir = '/app/raneto/themes/default/public'; diff --git a/root/defaults/server.js b/root/defaults/server.js index 43e81df..8e1b9f7 100644 --- a/root/defaults/server.js +++ b/root/defaults/server.js @@ -1,9 +1,23 @@ #!/usr/bin/env node -'use strict'; + +// Modules var debug = require('debug')('raneto'); + +// Here is where we load Raneto. +// When you are in your own project repository, +// Raneto should be installed via NPM and loaded as: var raneto = require('./app/index.js'); -var config = require('/config/config.default.js'); + +// Then, we load our configuration file +// This can be done inline, with a JSON file, +// or with a Node.js module as we do below. +var config = require('./config/config.default.js'); + +// Finally, we initialize Raneto +// with our configuration object var app = raneto(config); -var server = app.listen(app.get('port'), function () { - debug('Express HTTP server listening on port ' + server.address().port); + +// Load the HTTP Server +var server = app.listen(app.get('port'), app.get('host'), () => { + debug(`Express HTTP server listening on port ${server.address().port}`); }); diff --git a/root/etc/s6-overlay/s6-rc.d/svc-raneto/run b/root/etc/s6-overlay/s6-rc.d/svc-raneto/run index 1707c88..df6b9ec 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-raneto/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-raneto/run @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash # shellcheck shell=bash -exec \ +HOST=0.0.0.0 exec \ s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 3000" \ cd /app/raneto s6-setuidgid abc node server.js