~aleteoryx/tclfeed-bsky

ref: 0ad9282cf54a813e893af8092815302543ec55cc tclfeed-bsky/config.tcl -rw-r--r-- 569 bytes
0ad9282cAleteoryx a lot. chiefly httpd 30 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
if {$argc != 1} {
  puts stderr "Usage: $argv0 </path/to/config/file.ini>"
  exit -1
}
if [catch {set config [::ini::open [lindex $argv 0]]} result] {
  puts stderr "Couldn't open config: $result"
  exit -1
}

namespace eval ::config {
  proc require {config section key} {
    if ![ini::exists $config $section $key] {
      puts stderr "Missing [$section/$key] in config!"
      exit -2
    }
  }
  proc check {config} {
    require $config database path
    require $config database max_posts

    require $config atproto jetstream_host
  }
}

config::check $config