Skip to content

Commit

Permalink
feat: Add support for meshchat_local.lua (#47)
Browse files Browse the repository at this point in the history
Package upgrades do not update the `meshchatconfig.lua` because
it is tagged as a configuration file. This prevents settings
from being lost, but makes it difficult to add new settings
in future releases. This change establishes the `meshchat_local.lua`
file for local administrators to configure there MeshChat.

During installation of a package if a `meshchat_local.lua` is not
found, then a copy of `meshchatconfig.lua` is copied and
sanitized of the `app_version` and `protocol_version` settings.

Signed-off-by: Gerard Hickey <hickey@kinetic-compute.com>
  • Loading branch information
hickey committed Mar 3, 2024
1 parent 1cd2f8c commit b51bb16
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -13,4 +13,6 @@ If you are looking for a feature to be implemented or find a bug, please
be sure to [create an issue](https://github.com/hickey/meshchat/issues/new)
in the project so that it can be prioritized.

Current documentation for MeshChat can be found at:

https://hickey.github.io/meshchat
27 changes: 25 additions & 2 deletions docs/Install.md
Expand Up @@ -10,8 +10,31 @@ system will be started within a couple of seconds.

Usually there is not really any configuration that needs to be done, but
review of the [configuration settings](../module/meshchatconfig.html) is
suggested. To make any configuration changes one needs to log into the
node using SSH and edit the file `/www/cgi-bin/meshchatconfig.lua`.
suggested.

Starting with `v2.12.0` the configuration of MeshChat occurs in the file
`/www/cgi-bin/meshchat_local.lua`. Any configuration settings that need
to be modified need to be entered into the `meshchat_local.lua` file and
not in the `meshchatconfig.lua` file that previous version used to
configure MeshChat. Making changes to `meshchatconfig.lua` will be lost
when MeshChat is upgraded or downgraded. Making changes to the configuration
still requires one to SSH into the node and edit `meshchat_local.lua`
directly.

## Setting the MeshChat Zone Name

MeshChat uses a zone name to locate other MeshChat servers running with
the same zone name. Once servers are added to the same zone name, they
will automatically synchronize their message databases with one another.
Setting the zone name is done in the AREDN node adminstration settings
under the advertised services.

After a new install of MeshChat the installation will randomly generate
a zone name and register it with the AREDN node. The service name
(i.e. zone name) can be changed to the desired zone name used by other
MeshChat servers. Once the service name has been saved, it is best to
reboot the AREDN node to insure that MeshChat is restarted with the
correct zone name.

## Installing MeshChat on Linux

Expand Down
12 changes: 12 additions & 0 deletions meshchatconfig.lua
@@ -1,4 +1,14 @@
--[[
STOP STOP STOP DO NOT EDIT THIS FILE
This file is used to set default values for MeshChat and should NOT
be edited. Edits made to this file WILL BE LOST when upgrading or
downgrading MeshChat. All the values below can be overridden by
adding them to the meshchat_local.lua file located in the same
directory as this file.
EDIT THIS FILE AT YOUR PERIL. YOU HAVE BEEN WARNED.
Part of AREDN -- Used for creating Amateur Radio Emergency Data Networks
Copyright (C) 2022 Tim Wilkinson
Expand Down Expand Up @@ -77,3 +87,5 @@ extra_nodes = {}
protocol_version = "1.02"
app_version = "master"
default_channel = ""
require("meshchat_local")
1 change: 0 additions & 1 deletion package/meshchat/conffiles

This file was deleted.

12 changes: 12 additions & 0 deletions package/meshchat/preinst
Expand Up @@ -4,4 +4,16 @@

mkdir -p /www/meshchat

# if there is not a meshchat_local.lua, then prepare one
if [ ! -f /www/cgi-bin/meshchat_local.lua ]; then
if [ -f /www/cgi-bin/meshchatconfig.lua ]; then
cp /www/cgi-bin/meshchatconfig.lua /www/cgi-bin/meshchat_local.lua

# remove vars that should not be in meshchat_local.lua
sed -i "/^protocol_version/d; /^app_version/d" /www/cgi-bin/meshchat_local.lua
else
touch /www/cgi-bin/meshchat_local.lua
fi
fi

exit 0

0 comments on commit b51bb16

Please sign in to comment.