Skip to content

Commit

Permalink
converts config to yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
jshuping committed Aug 11, 2024
1 parent 717f11c commit efc5381
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 99 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ output/*
mosquitto/data/*
postgres/data/*
config.json
config.yaml
spa
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ cd meshinfo

##### Edit Configuration

1. Copy and then edit the `config.json.sample` to `config.json`.
1. Copy and then edit the `config.yaml.sample` to `config.yaml`.
2. Edit the `Caddyfile` and be sure it is setup for your hostname (FQDN if requiring Let's Encrypt cert to be generated) and your email address for the TLS line. If you only wish to use a self-signed certificate (and are OK with the browser warnings about this), then change it from your email address to `tls internal`.
3. Edit the `docker-compose.yml` (or `docker-compose-dev.yml` if you are going to use that one) and adjust any port mappings for caddy if you wish to have it run on anything other than 80/443. Keep in mind that if you are not using a FQDN and ports 80/443, Caddy will fail to provision a Let's Encrypt certificate. This is because Let's Encrypt requires 80/443 to be accessible and this is not a limitation of Caddy nor MeshInfo.

Expand Down
93 changes: 0 additions & 93 deletions config.json.sample

This file was deleted.

6 changes: 3 additions & 3 deletions config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

import datetime
import json
import uuid
import yaml

class Config:
@classmethod
def load(cls):
config = cls.load_from_file('config.json')
config = cls.load_from_file('config.yaml')
random_uuid = str(uuid.uuid4())
config['broker']['client_id'] = config['broker']['client_id_prefix'] + '-' + random_uuid
config['server']['start_time'] = datetime.datetime.now(datetime.timezone.utc).astimezone()
Expand All @@ -23,4 +23,4 @@ def load(cls):
@classmethod
def load_from_file(cls, path):
with open(path, 'r') as f:
return json.load(f)
return yaml.safe_load(f)
82 changes: 82 additions & 0 deletions config.yaml.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
mesh:
name: Sac Valley Mesh
shortname: SVM
description: Serving Meshtastic to the Sacramento Valley and surrounding areas.
url: https://sacvalleymesh.com
contact: https://sacvalleymesh.com
country: US
region: California
metro: Sacramento
latitude: 38.58
longitude: -121.49
altitude: 0
timezone: America/Los_Angeles
announce:
enabled: true
interval: 60
tools:
- name: Armooo's MeshView
url: https://meshview.armooo.net
- name: Liam's Meshtastic Map
url: https://meshtastic.liamcottle.net
- name: MeshMap
url: https://meshmap.net
- name: Bay Mesh Explorer
url: https://app.bayme.sh
- name: HWT Path Profiler
url: https://heywhatsthat.com/profiler.html
broker:
enabled: true
host: mqtt.meshtastic.org
port: 1883
username: meshdev
password: large4cats
client_id_prefix: meshinfo-dev
topics:
- msh/US/CA/SacValley/#
- msh/US/CA/sacvalley/#
decoders:
protobuf:
enabled: true
json:
enabled: true
channels:
encryption:
- key: 1PG7OiApB1nwvP+rz05pAQ==
key_name: Default
display:
- '0'
paths:
backups: output/backups
data: output/data
output: output/static-html
templates: templates
server:
node_id: 4355f528
base_url: REPLACE_WITH_THE_URL_OF_THIS_SERVER_WITHOUT_TRAILING_SLASH
node_activity_prune_threshold: 7200
timezone: America/Los_Angeles
intervals:
data_save: 300
render: 5
backups:
enabled: true
interval: 86400
enrich:
enabled: true
interval: 900
provider: world.meshinfo.network
graph:
enabled: true
max_depth: 10
integrations:
discord:
enabled: false
token: REPLACE_WITH_TOKEN
guild: REPLACE_WITH_GUILD_ID
geocoding:
enabled: false
provider: geocode.maps.co
geocode.maps.co:
api_key: REPLACE_WITH_API_KEY
debug: false
2 changes: 1 addition & 1 deletion docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
context: .
dockerfile: Dockerfile
volumes:
- ./config.json:/app/config.json
- ./config.yaml:/app/config.yaml
- ./output:/app/output
- ./templates:/app/templates
- ./spa:/app/spa
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ services:
meshinfo:
image: ghcr.io/meshaddicts/meshinfo:latest
volumes:
- ./config.json:/app/config.json
- ./config.yaml:/app/config.yaml
- ./output:/app/output
environment:
- PYTHONUNBUFFERED=1
Expand Down

0 comments on commit efc5381

Please sign in to comment.