diff --git a/.gitignore b/.gitignore index 7c1722d..08280a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ node_modules uploads/* !uploads/.keep + +internal/frontend/frontend_generated.go +citadel diff --git a/cmd/citadel/main.go b/cmd/citadel/main.go index ff9db8b..a263872 100644 --- a/cmd/citadel/main.go +++ b/cmd/citadel/main.go @@ -1,62 +1,10 @@ package main import ( - "fmt" + "github.com/jordanknott/project-citadel/api/internal/commands" _ "github.com/lib/pq" - "io/ioutil" - "net/http" - "time" - - "github.com/BurntSushi/toml" - "github.com/jmoiron/sqlx" - "github.com/jordanknott/project-citadel/api/internal/route" - log "github.com/sirupsen/logrus" ) -type Database struct { - Host string - Name string - User string - Password string -} -type AppConfig struct { - Database Database -} - func main() { - dat, err := ioutil.ReadFile("conf/app.toml") - if err != nil { - panic(err) - } - - var appConfig AppConfig - _, err = toml.Decode(string(dat), &appConfig) - if err != nil { - panic(err) - } - - Formatter := new(log.TextFormatter) - Formatter.TimestampFormat = "02-01-2006 15:04:05" - Formatter.FullTimestamp = true - log.SetFormatter(Formatter) - log.SetLevel(log.InfoLevel) - connection := fmt.Sprintf("user=%s password=%s host=%s dbname=%s sslmode=disable", - appConfig.Database.User, - appConfig.Database.Password, - appConfig.Database.Host, - appConfig.Database.Name, - ) - db, err := sqlx.Connect("postgres", connection) - if err != nil { - log.Panic(err) - } - db.SetMaxOpenConns(25) - db.SetMaxIdleConns(25) - db.SetConnMaxLifetime(5 * time.Minute) - - defer db.Close() - fmt.Println("starting graphql server on http://localhost:3333") - fmt.Println("starting graphql playground on http://localhost:3333/__graphql") - r, _ := route.NewRouter(db) - http.ListenAndServe(":3333", r) + commands.Execute() } diff --git a/conf/app.toml b/conf/app.toml index ffee241..1741aad 100644 --- a/conf/app.toml +++ b/conf/app.toml @@ -1,5 +1,24 @@ +[general] +host = '0.0.0.0:3333' + +[email_notifications] +enabled = true +display_name = "No Reply" +from_address = "example.com" + +[storage] +storage_system = 'local_storage' +upload_dir_path = 'uploads' + [database] host = '0.0.0.0' -name = 'citadel' +name = 'citadel_test' user = 'postgres' password = 'test' + +[smtp] +username = 'admin@example.com' +password = 'example' +server = 'mail.example.com' +port = 465 +connection_security = 'STARTTLS' diff --git a/frontend/package.json b/frontend/package.json index 162a905..68e5aab 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -70,6 +70,7 @@ "styled-components": "^5.0.1", "typescript": "~3.7.2" }, + "proxy": "http://localhost:3333", "scripts": { "start": "react-scripts start", "build": "react-scripts build", diff --git a/frontend/public/index.html b/frontend/public/index.html index 4176852..86d27fb 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -2,19 +2,19 @@ - + - + - +