Skip to content

Commit

Permalink
fix ENV propagation problem, update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
krustowski committed Jul 8, 2024
1 parent 722a9db commit d804db9
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
#

APP_NAME=litter-go
APP_VERSION=0.35.6
APP_VERSION=0.35.7
GOLANG_VERSION=1.22
2 changes: 1 addition & 1 deletion api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"name": "MIT",
"url": "https://github.com/krustowski/litter-go/blob/master/LICENSE"
},
"version": "0.35.6"
"version": "0.35.7"
},
"host": "littr.n0p.cz",
"basePath": "/api/v1",
Expand Down
6 changes: 4 additions & 2 deletions cmd/littr/http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ func initServer() {
ThemeColor: "#000000",
Version: os.Getenv("APP_VERSION") + "-" + time.Now().Format("2006-01-02_15:04:05"),
Env: map[string]string{
"APP_VERSION": os.Getenv("APP_VERSION"),
"VAPID_PUB_KEY": os.Getenv("VAPID_PUB_KEY"),
"APP_VERSION": os.Getenv("APP_VERSION"),
"APP_ENVIRONMENT": os.Getenv("APP_ENVIRONMENT"),
"REGISTRATION_ENABLED": os.Getenv("REGISTRATION_ENABLED"),
"VAPID_PUB_KEY": os.Getenv("VAPID_PUB_KEY"),
},
Preconnect: []string{
//"https://cdn.savla.dev/",
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/router.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @title litter-go
// @version 0.35.6
// @version 0.35.7
// @description nanoblogging platform as PWA built on go-app framework
// @termsOfService https://littr.n0p.cz/tos

Expand Down
5 changes: 1 addition & 4 deletions pkg/frontend/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"crypto/sha512"
"encoding/json"
"fmt"
"os"
"strings"

"go.savla.dev/littr/configs"
Expand Down Expand Up @@ -173,8 +172,6 @@ func (c *loginContent) dismissToast(ctx app.Context, e app.Event) {
}

func (c *loginContent) Render() app.UI {
registration := os.Getenv("REGISTRATION_ENABLED")

return app.Main().Class("responsive").Body(
app.Div().Class("row").Body(
app.Div().Class("max padding").Body(
Expand Down Expand Up @@ -230,7 +227,7 @@ func (c *loginContent) Render() app.UI {
),

// register button
app.If(registration == "true",
app.If(app.Getenv("REGISTRATION_ENABLED") == "true",
app.Button().Class("max deep-orange7 white-text bold").Style("border-radius", "8px").TabIndex(5).OnClick(c.onClickRegister).Disabled(c.loginButtonDisabled).Body(
app.Text("register"),
),
Expand Down
7 changes: 2 additions & 5 deletions pkg/frontend/navbars.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/base64"
"encoding/json"
"log"
"os"
"strconv"
"time"

Expand Down Expand Up @@ -257,8 +256,6 @@ func (h *header) Render() app.UI {
// a very nasty way on how to store the timestamp...
var last int64 = 0

environ := os.Getenv("APP_ENVIRONMENT")

beat := app.Window().Get("localStorage")
if !beat.IsNull() && !beat.Call("getItem", "lastEventTime").IsNull() {
str := beat.Call("getItem", "lastEventTime").String()
Expand Down Expand Up @@ -328,7 +325,7 @@ func (h *header) Render() app.UI {
app.H4().Class("center-align deep-orange-text").OnClick(h.onClickHeadline).ID("top-header").Body(
app.Span().Body(
app.Text(headerString),
app.If(environ == "dev",
app.If(app.Getenv("APP_ENVIRONMENT") == "dev",
app.Span().Class("col").Body(
app.Sup().Body(
app.Text(" (beta) "),
Expand Down Expand Up @@ -363,7 +360,7 @@ func (h *header) Render() app.UI {
app.H4().Body(
app.Span().Body(
app.Text("littr"),
app.If(environ == "dev",
app.If(app.Getenv("APP_ENVIRONMENT") == "dev",
app.Span().Class("col").Body(
app.Sup().Body(
app.Text(" (beta) "),
Expand Down
5 changes: 1 addition & 4 deletions pkg/frontend/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"log"
"net/mail"
"os"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -211,8 +210,6 @@ func (c *registerContent) dismissToast(ctx app.Context, e app.Event) {
}

func (c *registerContent) Render() app.UI {
registration := os.Getenv("REGISTRATION_ENABLED")

return app.Main().Class("responsive").Body(
app.Div().Class("row").Body(
app.Div().Class("max padding").Body(
Expand Down Expand Up @@ -299,7 +296,7 @@ func (c *registerContent) Render() app.UI {

// register button
app.Div().Class("row").Body(
app.If(registration == "true",
app.If(app.Getenv("REGISTRATION_ENABLED") == "true",
app.Button().Class("max deep-orange7 white-text bold").Style("border-radius", "8px").OnClick(c.onClickRegister).Disabled(c.registerButtonDisabled).Body(
app.Text("register"),
),
Expand Down

0 comments on commit d804db9

Please sign in to comment.