-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #277 from keep-starknet-strange/feat/websockets
Feat: Full Homescreen, ws server, ...
- Loading branch information
Showing
31 changed files
with
773 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM golang:1.22.2-alpine | ||
|
||
RUN apk add --no-cache bash curl git jq | ||
|
||
# Copy over the configs | ||
WORKDIR /configs | ||
COPY ./configs/ . | ||
COPY ./configs/docker-database.config.json ./database.config.json | ||
COPY ./configs/docker-backend.config.json ./backend.config.json | ||
|
||
# Copy over the app | ||
WORKDIR /app | ||
COPY ./backend/go.mod ./backend/go.sum ./ | ||
RUN go mod download | ||
COPY ./backend . | ||
|
||
# Build the app & run it | ||
RUN go build -o web-sockets ./cmd/web-sockets/web-sockets.go | ||
|
||
EXPOSE 8082 | ||
|
||
CMD ["./web-sockets"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM --platform=linux/amd64 golang:1.22.2-alpine | ||
|
||
RUN apk add --no-cache bash curl git jq | ||
|
||
# Copy over the configs | ||
WORKDIR /configs | ||
COPY ./configs/ . | ||
COPY ./configs/prod-database.config.json ./database.config.json | ||
COPY ./configs/prod-backend.config.json ./backend.config.json | ||
|
||
# Copy over the app | ||
WORKDIR /app | ||
COPY ./backend/go.mod ./backend/go.sum ./ | ||
RUN go mod download | ||
COPY ./backend . | ||
|
||
# Build the app & run it | ||
RUN go build -o web-sockets ./cmd/web-sockets/web-sockets.go | ||
|
||
EXPOSE 8082 | ||
|
||
CMD ["./web-sockets"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
|
||
"github.com/keep-starknet-strange/art-peace/backend/config" | ||
"github.com/keep-starknet-strange/art-peace/backend/core" | ||
"github.com/keep-starknet-strange/art-peace/backend/routes" | ||
) | ||
|
||
func isFlagSet(name string) bool { | ||
found := false | ||
flag.Visit(func(f *flag.Flag) { | ||
if f.Name == name { | ||
found = true | ||
} | ||
}) | ||
return found | ||
} | ||
|
||
func main() { | ||
roundsConfigFilename := flag.String("rounds-config", config.DefaultRoundsConfigPath, "Rounds config file") | ||
canvasConfigFilename := flag.String("canvas-config", config.DefaultCanvasConfigPath, "Canvas config file") | ||
databaseConfigFilename := flag.String("database-config", config.DefaultDatabaseConfigPath, "Database config file") | ||
backendConfigFilename := flag.String("backend-config", config.DefaultBackendConfigPath, "Backend config file") | ||
production := flag.Bool("production", false, "Production mode") | ||
|
||
flag.Parse() | ||
|
||
roundsConfig, err := config.LoadRoundsConfig(*roundsConfigFilename) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
canvasConfig, err := config.LoadCanvasConfig(*canvasConfigFilename) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
databaseConfig, err := config.LoadDatabaseConfig(*databaseConfigFilename) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
backendConfig, err := config.LoadBackendConfig(*backendConfigFilename) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
if isFlagSet("production") { | ||
backendConfig.Production = *production | ||
} | ||
|
||
databases := core.NewDatabases(databaseConfig) | ||
defer databases.Close() | ||
|
||
core.ArtPeaceBackend = core.NewBackend(databases, roundsConfig, canvasConfig, backendConfig, false) | ||
|
||
routes.InitBaseRoutes() | ||
routes.InitWebsocketRoutes() | ||
routes.StartWebsocketServer() | ||
|
||
core.ArtPeaceBackend.Start(core.ArtPeaceBackend.BackendConfig.WsPort) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"canvas": { | ||
"width": 518, | ||
"width": 528, | ||
"height": 396 | ||
}, | ||
"colors": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.