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 8, 2024
1 parent 717f11c commit 7840b95
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 @@
broker:
channels:
display:
- '0'
encryption:
- key: 1PG7OiApB1nwvP+rz05pAQ==
key_name: Default
client_id_prefix: meshinfo-dev
decoders:
json:
enabled: true
protobuf:
enabled: true
enabled: true
host: mqtt.meshtastic.org
password: large4cats
port: 1883
topics:
- msh/US/CA/SacValley/#
- msh/US/CA/sacvalley/#
username: meshdev
debug: false
integrations:
discord:
enabled: false
guild: REPLACE_WITH_GUILD_ID
token: REPLACE_WITH_TOKEN
geocoding:
enabled: false
geocode.maps.co:
api_key: REPLACE_WITH_API_KEY
provider: geocode.maps.co
mesh:
altitude: 0
announce:
enabled: true
interval: 60
contact: https://sacvalleymesh.com
country: US
description: Serving Meshtastic to the Sacramento Valley and surrounding areas.
latitude: 38.58
longitude: -121.49
metro: Sacramento
name: Sac Valley Mesh
region: California
shortname: SVM
timezone: America/Los_Angeles
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
url: https://sacvalleymesh.com
paths:
backups: output/backups
data: output/data
output: output/static-html
templates: templates
server:
backups:
enabled: true
interval: 86400
base_url: REPLACE_WITH_THE_URL_OF_THIS_SERVER_WITHOUT_TRAILING_SLASH
enrich:
enabled: true
interval: 900
provider: world.meshinfo.network
graph:
enabled: true
max_depth: 10
intervals:
data_save: 300
render: 5
node_activity_prune_threshold: 7200
node_id: 4355f528
timezone: America/Los_Angeles
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 7840b95

Please sign in to comment.