projects.go (1740B)
1 package config 2 3 import ( 4 "os" 5 "strings" 6 ) 7 8 const defaultGitWebBase = "https://git.prime8.dev" 9 10 type Project struct { 11 ID string 12 Name string 13 Subtitle string 14 Tech []string 15 URL string 16 Repo string 17 Markdown string 18 HTML string 19 } 20 21 // GitWebBase is the base URL of the stagit pages (env GIT_WEB_BASE). 22 func GitWebBase() string { 23 base := strings.TrimSpace(os.Getenv("GIT_WEB_BASE")) 24 if base == "" { 25 base = defaultGitWebBase 26 } 27 return strings.TrimSuffix(base, "/") 28 } 29 30 // GitProjectURL is the public stagit page for a repo: <base>/<repo>/. 31 func GitProjectURL(repo string) string { 32 return GitWebBase() + "/" + repo + "/" 33 } 34 35 func GetProjects() []Project { 36 return []Project{ 37 { 38 ID: "janitor", 39 Name: "janitor", 40 Subtitle: "audio classification with ast", 41 Tech: []string{"rust", "cuda"}, 42 URL: GitProjectURL("janitor"), 43 Repo: "janitor", 44 }, 45 { 46 ID: "summarizer", 47 Name: "summarizer", 48 Subtitle: "audio transcription microservices", 49 Tech: []string{"python", "docker", "kafka"}, 50 URL: GitProjectURL("summarizer"), 51 Repo: "summarizer", 52 }, 53 { 54 ID: "finger", 55 Name: "finger", 56 Subtitle: "mobile auth app", 57 Tech: []string{"typescript", "react native", "supabase"}, 58 URL: GitProjectURL("finger"), 59 Repo: "finger", 60 }, 61 { 62 ID: "computer-science-club", 63 Name: "computer-science-club", 64 Subtitle: "cs club website", 65 Tech: []string{"python", "rest"}, 66 URL: GitProjectURL("computer-science-club"), 67 Repo: "computer-science-club", 68 }, 69 } 70 } 71 72 func GetProjectByID(id string) *Project { 73 for _, p := range GetProjects() { 74 if p.ID == id { 75 return &p 76 } 77 } 78 return nil 79 }