Skip to content

Commit

Permalink
Linting, working on shardgroup and shards
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRockettek committed Sep 7, 2021
1 parent 0c891f8 commit 863e669
Show file tree
Hide file tree
Showing 46 changed files with 4,325 additions and 3,631 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.git
web/node_modules
.git
web/node_modules
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
*.js linguist-detectable=false
*.js linguist-detectable=false
*.map linguist-detectable=false
142 changes: 71 additions & 71 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '24 15 * * 3'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '24 15 * * 3'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
24 changes: 12 additions & 12 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
echo "Build GO Executable"
go build -v -o sandwich cmd/main.go

echo "Build Web Distributable"
#!cd web
#!yarn lint
#!yarn build --modern
#!cd ..

echo "Docker build and push"
docker build --tag 1345/sandwich-daemon:latest .
docker push 1345/sandwich-daemon:latest
echo "Build GO Executable"
go build -v -o sandwich cmd/main.go

echo "Build Web Distributable"
#!cd web
#!yarn lint
#!yarn build --modern
#!cd ..

echo "Docker build and push"
docker build --tag 1345/sandwich-daemon:latest .
docker push 1345/sandwich-daemon:latest
110 changes: 55 additions & 55 deletions cmd/main.go
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
package main

import (
"flag"
"os"
"os/signal"
"syscall"
"time"

internal "github.com/WelcomerTeam/Sandwich-Daemon/next/internal"
"github.com/rs/zerolog"
)

func main() {
lFlag := flag.String("level", "info", "Global log level to use (debug/info/warn/error/fatal/panic/no/disabled/trace) (default: info)")
lConfigurationLocation := flag.String("configuration", "sandwich.yaml", "Path of configuration file (default: sandwich.yaml)")
lPoolConcurrency := flag.Int("concurrency", 512, "Total number of events that can be processed concurrently (default: 512)")

flag.Parse()

// Parse flag and configure logging
level, err := zerolog.ParseLevel(*lFlag)
if err != nil {
level = zerolog.InfoLevel
}

zerolog.SetGlobalLevel(level)

consoleWriter := zerolog.ConsoleWriter{
Out: os.Stdout,
TimeFormat: time.Stamp,
}

log := zerolog.New(consoleWriter).With().Timestamp().Logger()

// Sandwich initialization
sandwich, err := internal.NewSandwich(consoleWriter, *lConfigurationLocation, *lPoolConcurrency)
if err != nil {
log.Panic().Err(err).Msg("Cannot create sandwich")
}

err = sandwich.Open()
if err != nil {
log.Panic().Err(err).Msg("Cannot open sandwich")
}

signalCh := make(chan os.Signal, 1)
signal.Notify(signalCh, syscall.SIGINT, syscall.SIGTERM, os.Interrupt)
<-signalCh

err = sandwich.Close()
if err != nil {
sandwich.Logger.Warn().Err(err).Msg("Exception whilst closing sandwich")
}
}
package main

import (
"flag"
"os"
"os/signal"
"syscall"
"time"

internal "github.com/WelcomerTeam/Sandwich-Daemon/next/internal"
"github.com/rs/zerolog"
)

func main() {
lFlag := flag.String("level", "info", "Global log level to use (debug/info/warn/error/fatal/panic/no/disabled/trace) (default: info)")
lConfigurationLocation := flag.String("configuration", "sandwich.yaml", "Path of configuration file (default: sandwich.yaml)")
lPoolConcurrency := flag.Int("concurrency", 512, "Total number of events that can be processed concurrently (default: 512)")

flag.Parse()

// Parse flag and configure logging
level, err := zerolog.ParseLevel(*lFlag)
if err != nil {
level = zerolog.InfoLevel
}

zerolog.SetGlobalLevel(level)

consoleWriter := zerolog.ConsoleWriter{
Out: os.Stdout,
TimeFormat: time.Stamp,
}

log := zerolog.New(consoleWriter).With().Timestamp().Logger()

// Sandwich initialization
sandwich, err := internal.NewSandwich(consoleWriter, *lConfigurationLocation, *lPoolConcurrency)
if err != nil {
log.Panic().Err(err).Msg("Cannot create sandwich")
}

err = sandwich.Open()
if err != nil {
log.Panic().Err(err).Msg("Cannot open sandwich")
}

signalCh := make(chan os.Signal, 1)
signal.Notify(signalCh, syscall.SIGINT, syscall.SIGTERM, os.Interrupt)
<-signalCh

err = sandwich.Close()
if err != nil {
sandwich.Logger.Warn().Err(err).Msg("Exception whilst closing sandwich")
}
}
Loading

0 comments on commit 863e669

Please sign in to comment.