mirror of
https://github.com/thomiceli/opengist.git
synced 2024-12-23 04:52:40 +00:00
refactor!: prefix DEV env var and deprecate CONFIG (#64)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
This commit is contained in:
parent
62711ff491
commit
fc421a68b5
3 changed files with 8 additions and 6 deletions
2
Makefile
2
Makefile
|
@ -31,7 +31,7 @@ watch_frontend:
|
||||||
|
|
||||||
watch_backend:
|
watch_backend:
|
||||||
@echo "Building Opengist binary..."
|
@echo "Building Opengist binary..."
|
||||||
DEV=1 ./node_modules/.bin/nodemon --watch '**/*' -e html,yml,go,js --signal SIGTERM --exec 'go run . --config config.yml'
|
OG_DEV=1 ./node_modules/.bin/nodemon --watch '**/*' -e html,yml,go,js --signal SIGTERM --exec 'go run . --config config.yml'
|
||||||
|
|
||||||
watch:
|
watch:
|
||||||
@bash ./watch.sh
|
@bash ./watch.sh
|
||||||
|
|
|
@ -2,15 +2,16 @@ package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/rs/zerolog"
|
|
||||||
"github.com/rs/zerolog/log"
|
|
||||||
"github.com/thomiceli/opengist/internal/utils"
|
|
||||||
"gopkg.in/yaml.v3"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/rs/zerolog"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
"github.com/thomiceli/opengist/internal/utils"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
var OpengistVersion = "1.4.0-dev"
|
var OpengistVersion = "1.4.0-dev"
|
||||||
|
@ -173,6 +174,7 @@ func loadConfigFromYaml(c *config, configPath string) error {
|
||||||
configEnv := os.Getenv("CONFIG")
|
configEnv := os.Getenv("CONFIG")
|
||||||
if configEnv != "" {
|
if configEnv != "" {
|
||||||
fmt.Println("Using config from environment variable: CONFIG")
|
fmt.Println("Using config from environment variable: CONFIG")
|
||||||
|
fmt.Println("!! This method of setting the config is deprecated and will be removed in a future version of Opengist")
|
||||||
d := yaml.NewDecoder(strings.NewReader(configEnv))
|
d := yaml.NewDecoder(strings.NewReader(configEnv))
|
||||||
if err := d.Decode(&c); err != nil {
|
if err := d.Decode(&c); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -24,7 +24,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var dev = os.Getenv("DEV") == "1"
|
var dev = os.Getenv("OG_DEV") == "1"
|
||||||
var store *sessions.CookieStore
|
var store *sessions.CookieStore
|
||||||
var re = regexp.MustCompile("[^a-z0-9]+")
|
var re = regexp.MustCompile("[^a-z0-9]+")
|
||||||
var fm = template.FuncMap{
|
var fm = template.FuncMap{
|
||||||
|
|
Loading…
Reference in a new issue