aboutsummaryrefslogtreecommitdiff
path: root/internal/config
diff options
context:
space:
mode:
authorXe Iaso <me@christine.website>2023-09-30 10:36:37 -0400
committerGitHub <noreply@github.com>2023-09-30 10:36:37 -0400
commitac6a3df0d18cc73524c0096d954a57d24cad5669 (patch)
tree81474177d730440657f490ae29892d62392251ea /internal/config
parentcbdea8ba3fca9a663778af71f8df5965aeb6c090 (diff)
downloadxesite-ac6a3df0d18cc73524c0096d954a57d24cad5669.tar.xz
xesite-ac6a3df0d18cc73524c0096d954a57d24cad5669.zip
Xesite V4 (#723)
* scripts/ditherify: fix quoting Signed-off-by: Xe Iaso <me@xeiaso.net> * clean up some old files Signed-off-by: Xe Iaso <me@xeiaso.net> * import site into lume Signed-off-by: Xe Iaso <me@xeiaso.net> * initial go code Signed-off-by: Xe Iaso <me@xeiaso.net> * move vods index to top level Signed-off-by: Xe Iaso <me@xeiaso.net> * remove the ads Signed-off-by: Xe Iaso <me@xeiaso.net> * internal/lume: metrics Signed-off-by: Xe Iaso <me@xeiaso.net> * delete old code Signed-off-by: Xe Iaso <me@xeiaso.net> * load config into memory Signed-off-by: Xe Iaso <me@xeiaso.net> * autogenerate data from dhall config Signed-off-by: Xe Iaso <me@xeiaso.net> * various cleanups, import clackset logic Signed-off-by: Xe Iaso <me@xeiaso.net> * Update signalboost.dhall (#722) Added myself, and also fixed someone’s typo * Add Connor Edwards to signal boost (#721) * add cache headers Signed-off-by: Xe Iaso <me@xeiaso.net> * move command to xesite folder Signed-off-by: Xe Iaso <me@xeiaso.net> * xesite: listen for GitHub webhook push events Signed-off-by: Xe Iaso <me@xeiaso.net> * xesite: 5 minute timeout for rebuilding the site Signed-off-by: Xe Iaso <me@xeiaso.net> * xesite: add rebuild metrics Signed-off-by: Xe Iaso <me@xeiaso.net> * xesite: update default variables Signed-off-by: Xe Iaso <me@xeiaso.net> * don't commit binaries oops lol Signed-off-by: Xe Iaso <me@xeiaso.net> * lume: make search have a light background Signed-off-by: Xe Iaso <me@xeiaso.net> * add a notfound page Signed-off-by: Xe Iaso <me@xeiaso.net> * fetch info from patreon API Signed-off-by: Xe Iaso <me@xeiaso.net> * create contact page Signed-off-by: Xe Iaso <me@xeiaso.net> * Toot embedding Signed-off-by: Xe Iaso <me@xeiaso.net> * attempt a docker image Signed-off-by: Xe Iaso <me@xeiaso.net> * lume: fix deno lock Signed-off-by: Xe Iaso <me@xeiaso.net> * add gokrazy post Signed-off-by: Xe Iaso <me@xeiaso.net> * cmd/xesite: go up before trying to connect to the saas proxy Signed-off-by: Xe Iaso <me@xeiaso.net> * blog: add Sine post/demo Signed-off-by: Xe Iaso <me@xeiaso.net> --------- Signed-off-by: Xe Iaso <me@xeiaso.net> Co-authored-by: bri <284789+b-@users.noreply.github.com> Co-authored-by: Connor Edwards <38229097+cedws@users.noreply.github.com>
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/config.go157
-rw-r--r--internal/config/config_test.go11
2 files changed, 168 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
new file mode 100644
index 0000000..f09e430
--- /dev/null
+++ b/internal/config/config.go
@@ -0,0 +1,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"`
+}
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
new file mode 100644
index 0000000..fdf04df
--- /dev/null
+++ b/internal/config/config_test.go
@@ -0,0 +1,11 @@
+package config
+
+import (
+ "testing"
+)
+
+func TestLoad(t *testing.T) {
+ if _, err := Load("../../config.dhall"); err != nil {
+ t.Error(err)
+ }
+}