Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
blylei committed Jul 1, 2024
1 parent ac6c6ae commit bb870da
Show file tree
Hide file tree
Showing 154 changed files with 2,290 additions and 2,068 deletions.
48 changes: 45 additions & 3 deletions cmd/frabit-server/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,26 @@
package cmd

import (
"context"
"fmt"
"os"
"os/signal"
"syscall"
"time"

"github.com/frabits/frabit/pkg/common/version"
"github.com/frabits/frabit/pkg/config"
"github.com/frabits/frabit/pkg/server"

"github.com/spf13/cobra"
)

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "frabit-server",
Short: "Frabit The next-generation database automatic platform",
Use: "frabit-server",
Short: "Frabit The next-generation database automatic platform",
RunE: start,
Version: version.InfoStr.String(),
}

// Execute adds all child commands to the root command and sets flags appropriately.
Expand All @@ -36,6 +47,37 @@ func Execute() {
}
}

func start(cmd *cobra.Command, args []string) error {
ctx := context.Background()
cfg := config.Conf
srv := server.NewServer(cfg)

go listenToSystemSignals(ctx, srv)
return srv.Run()
}

func listenToSystemSignals(ctx context.Context, src *server.Server) {
signalChan := make(chan os.Signal, 1)
sighupChan := make(chan os.Signal, 1)

signal.Notify(sighupChan, syscall.SIGHUP)
signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)

for {
select {
case <-sighupChan:
fmt.Println("nothing,maybe reload config in the future")
case sig := <-signalChan:
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
if err := src.Shutdown(ctx, fmt.Sprintf("System signal:%s", sig)); err != nil {
fmt.Fprintf(os.Stderr, "Timed out waiting for server to shut down")
}
}
}
}

func init() {
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
rootCmd.Flags().BoolP("version", "v", false, "Display frabit-server version")
rootCmd.Flags().String("config", "/etc/frabit/frabit-server.yml", "Specific frabit config file")
}
71 changes: 0 additions & 71 deletions cmd/frabit-server/cmd/start.go

This file was deleted.

15 changes: 0 additions & 15 deletions frontend/.eslintrc.cjs

This file was deleted.

29 changes: 0 additions & 29 deletions frontend/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion frontend/.prettierrc.json

This file was deleted.

3 changes: 0 additions & 3 deletions frontend/.vscode/extensions.json

This file was deleted.

31 changes: 0 additions & 31 deletions frontend/README.md

This file was deleted.

1 change: 0 additions & 1 deletion frontend/env.d.ts

This file was deleted.

13 changes: 0 additions & 13 deletions frontend/index.html

This file was deleted.

45 changes: 0 additions & 45 deletions frontend/package.json

This file was deleted.

Binary file removed frontend/public/favicon.ico
Binary file not shown.
Binary file removed frontend/public/logo.png
Binary file not shown.
15 changes: 0 additions & 15 deletions frontend/src/App.vue

This file was deleted.

Empty file removed frontend/src/apis/apis.ts
Empty file.
16 changes: 0 additions & 16 deletions frontend/src/apis/loginApis.ts

This file was deleted.

74 changes: 0 additions & 74 deletions frontend/src/assets/base.css

This file was deleted.

Binary file removed frontend/src/assets/logo.jpeg
Binary file not shown.
Binary file removed frontend/src/assets/logo.png
Binary file not shown.
1 change: 0 additions & 1 deletion frontend/src/assets/logo.svg

This file was deleted.

Loading

0 comments on commit bb870da

Please sign in to comment.