aboutsummaryrefslogtreecommitdiff
path: root/internal/config/config.go
blob: f09e4309b5a4cc7277cbb7410eda0821f95e5982 (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
package config

import (
	"encoding/json"
	"os/exec"
)

var (
	dhallToJSONBin string
)

func init() {
	var err error
	dhallToJSONBin, err = exec.LookPath("dhall-to-json")
	if err != nil {
		panic(err)
	}
}

func Load(fname string) (*Config, error) {
	cmd := exec.Command(dhallToJSONBin, "--file", fname)

	out, err := cmd.Output()
	if err != nil {
		return nil, err
	}

	var result Config
	if err := json.Unmarshal(out, &result); err != nil {
		return nil, err
	}

	return &result, nil
}

type Config struct {
	Authors            map[string]Author    `json:"authors"`
	Characters         []Character          `json:"characters"`
	ClackSet           []string             `json:"clackSet"`
	ContactLinks       []Link               `json:"contactLinks"`
	DefaultAuthor      Author               `json:"defaultAuthor"`
	JobHistory         []Job                `json:"jobHistory"`
	MiToken            string               `json:"miToken"`
	NotableProjects    []NotableProjects    `json:"notableProjects"`
	Port               int                  `json:"port"`
	Pronouns           []Pronouns           `json:"pronouns"`
	SeriesDescMap      map[string]string    `json:"seriesDescMap"`
	SeriesDescriptions []SeriesDescriptions `json:"seriesDescriptions"`
	Signalboost        []Signalboost        `json:"signalboost"`
	WebMentionEndpoint string               `json:"webMentionEndpoint"`
	Resume             Resume               `json:"resume"`
}

type Pronouns struct {
	Accusative           string `json:"accusative"`
	Nominative           string `json:"nominative"`
	Possessive           string `json:"possessive"`
	PossessiveDeterminer string `json:"possessiveDeterminer"`
	Reflexive            string `json:"reflexive"`
	Singular             bool   `json:"singular"`
}

type Character struct {
	DefaultPose string   `json:"defaultPose"`
	Description string   `json:"description"`
	Name        string   `json:"name"`
	Pronouns    Pronouns `json:"pronouns"`
	StickerName string   `json:"stickerName"`
	Stickers    []string `json:"stickers"`
}

type Link struct {
	Description string `json:"description"`
	Title       string `json:"title"`
	URL         string `json:"url"`
}

type Author struct {
	Handle   string   `json:"handle"`
	Image    string   `json:"image"`
	InSystem bool     `json:"inSystem"`
	JobTitle string   `json:"jobTitle"`
	Name     string   `json:"name"`
	Pronouns Pronouns `json:"pronouns"`
	SameAs   []string `json:"sameAs"`
	URL      string   `json:"url"`
}

type Location struct {
	City            string `json:"city"`
	Country         string `json:"country"`
	Remote          bool   `json:"remote"`
	StateOrProvince string `json:"stateOrProvince"`
}

type Company struct {
	Defunct  bool     `json:"defunct"`
	Location Location `json:"location"`
	Name     string   `json:"name"`
	Tagline  string   `json:"tagline"`
	URL      string   `json:"url"`
}

type Salary struct {
	Amount   int    `json:"amount"`
	Currency string `json:"currency"`
	Per      string `json:"per"`
	Stock    *Stock `json:"stoc,omitempty"`
}

type Stock struct {
	Amount       int    `json:"amount"`
	CliffYears   int    `json:"cliffYears"`
	Kind         string `json:"kind"`
	Liquid       bool   `json:"liquid"`
	VestingYears int    `json:"vestingYears"`
}

type Job struct {
	Company        Company    `json:"company,omitempty"`
	Contract       bool       `json:"contract"`
	HideFromResume bool       `json:"hideFromResume"`
	Highlights     []string   `json:"highlights"`
	Locations      []Location `json:"locations"`
	Salary         Salary     `json:"salary,omitempty"`
	StartDate      string     `json:"startDate"`
	Title          string     `json:"title"`
	DaysWorked     int        `json:"daysWorked,omitempty"`
	EndDate        string     `json:"endDate,omitempty"`
	LeaveReason    string     `json:"leaveReason,omitempty"`
	DaysBetween    int        `json:"daysBetween,omitempty"`
}

type NotableProjects struct {
	Description string `json:"description"`
	Title       string `json:"title"`
	URL         string `json:"url"`
}

type SeriesDescriptions struct {
	Details string `json:"details"`
	Name    string `json:"name"`
}

type Signalboost struct {
	Links []Link   `json:"links"`
	Name  string   `json:"name"`
	Tags  []string `json:"tags"`
}

type Resume struct {
	Buzzwords           []string `json:"buzzwords"`
	Location            Location `json:"location"`
	Name                string   `json:"name"`
	NotablePublications []Link   `json:"notablePublications"`
	Tagline             string   `json:"tagline"`
}