-
Notifications
You must be signed in to change notification settings - Fork 11
/
config.go
55 lines (48 loc) · 1.29 KB
/
config.go
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main
import (
"log"
"github.com/BurntSushi/toml"
)
type AppConfig struct {
Drupal *DrupalConfig
Hpfeeds *HpfeedsConfig
PublicIP *PublicIPConfig `toml:"fetch_public_ip"`
}
// DrupalConfig provides configuration for how to host the Drupal web app
// portion of the honeypot.
// [drupal]
type DrupalConfig struct {
Version string // Version of Drupal to emulate
Port int
ChangelogEnabled bool `toml:"changelog_enabled"`
ChangelogFilepath string `toml:"changelog_filepath"`
SiteName string `toml:"site_name"`
NameRandomizer bool `toml:"name_randomizer"`
HeaderServer string `toml:"header_server"`
HeaderContentLanguage string `toml:"header_content_language"`
}
// HpfeedsConfig provides configuration for connecting to an hpfeeds broker
// server and credentials for publishing data.
// [hpfeeds]
type HpfeedsConfig struct {
Enabled bool
Host string
Port int
Ident string
Auth string
Channel string
Meta string
}
// [fetch_public_ip]
type PublicIPConfig struct {
Enabled bool
URLs []string
}
func loadConfig(filename string) *AppConfig {
var c AppConfig
_, err := toml.DecodeFile(filename, &c)
if err != nil {
log.Fatalf("Unable to parse config file: %s\n", err.Error())
}
return &c
}