diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index cb1778d..b06eae5 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -51,7 +51,6 @@ jobs: id: create_release uses: ncipollo/release-action@v1 with: - token: ${{ secrets.GITHUB_TOKEN }} name: Release ${{ github.ref }} diff --git a/.gitignore b/.gitignore index 87cbec8..d43b77b 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,5 @@ test/ node_modules/ dist/ -.direnv \ No newline at end of file +.direnv +result \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 4a85473..9cf12a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ RUN cd web && npm i && npm run build FROM golang as server WORKDIR /src COPY --from=web /src . -RUN go get . && go generate ./... && go build . +RUN go get . && go generate ./... && go build . -trimpath -ldflags "-w -s -X main.Version=v1.0.0" FROM scratch COPY --from=server /src/reCoreD-UI . diff --git a/flake.nix b/flake.nix index 75560a1..e046a55 100644 --- a/flake.nix +++ b/flake.nix @@ -8,7 +8,7 @@ utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; - name = "recored-ui"; + name = "reCoreD-UI"; version = "v1.0.0"; in { @@ -24,10 +24,12 @@ inherit version; src = self; + GOPROXY = "https://goproxy.cn,direct"; ldflags = [ "-s" "-w" + "-X main.Version=${version}" ]; configurePhase = '' @@ -37,7 +39,8 @@ installPhase = '' mkdir -p $out/bin - cp recored-ui $out/bin + ls -l + cp $HOME/go/bin/reCoreD-UI $out/bin ''; doCheck = false; @@ -50,7 +53,7 @@ src = self; installPhase = '' mkdir -p $out/bin - cp ${app}/bin/recored-ui $out/bin + cp ${app}/bin/reCoreD-UI $out/bin ''; }; @@ -87,12 +90,12 @@ }; config = mkIf cfg.enable { - systemd.services.recored-ui = { + systemd.services.reCoreD-UI = { wantedBy = [ "multi-uesr.target" ]; environment = { RECORED_MYSQL_DSN = cfg.mysql-dsn; }; - serviceconfig.ExecStart = "${defaultPackage}/bin/recored-ui server"; + serviceconfig.ExecStart = "${defaultPackage}/bin/reCoreD-UI server"; }; }; }; diff --git a/main.go b/main.go index 3f2eebe..ae09529 100644 --- a/main.go +++ b/main.go @@ -1,22 +1,25 @@ -/* +/* reCoreD-UI provides web ui for CoreDNS NAME: reCoreD-UI - Web UI for CoreDNS USAGE: - reCoreD-UI [global options] command [command options] + + reCoreD-UI [global options] command [command options] COMMANDS: - server run server - config config some settings - help, h Shows a list of commands or help for one command + + server run server + config config some settings + help, h Shows a list of commands or help for one command GLOBAL OPTIONS: - --config value, -c value config yaml file [$RECORED_CONFIG_FILE] - --mysql-dsn value mysql dsn [$RECORED_MYSQL_DSN] - --debug enable debug mode (default: false) - --help, -h show help + + --config value, -c value config yaml file [$RECORED_CONFIG_FILE] + --mysql-dsn value mysql dsn [$RECORED_MYSQL_DSN] + --debug enable debug mode (default: false) + --help, -h show help */ package main @@ -31,15 +34,18 @@ import ( "github.com/urfave/cli/v2/altsrc" ) +// will be modified when building +var Version string = "v0.0.1" + func init() { logrus.SetReportCaller(true) } -// @title reCoreD-UI API -// @version 1.0 -// @description APIs for reCoreD-UI -// @BasePath /api/v1 -// @securityDefinitions.basic BasicAuth +// @title reCoreD-UI API +// @version 1.0 +// @description APIs for reCoreD-UI +// @BasePath /api/v1 +// @securityDefinitions.basic BasicAuth func main() { flags := []cli.Flag{ &cli.StringFlag{ @@ -67,8 +73,9 @@ func main() { } app := &cli.App{ - Name: "reCoreD-UI", - Usage: "Web UI for CoreDNS", + Name: "reCoreD-UI", + Version: Version, + Usage: "Web UI for CoreDNS", Before: altsrc.InitInputSourceWithContext( flags, altsrc.NewYamlSourceFromFlagFunc("config"), ), diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 5388e92..0000000 --- a/package-lock.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "recored-ui", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "devDependencies": { - "@vicons/fa": "^0.12.0" - } - }, - "node_modules/@vicons/fa": { - "version": "0.12.0", - "resolved": "https://registry.npmmirror.com/@vicons/fa/-/fa-0.12.0.tgz", - "integrity": "sha512-g2PIeJLsTHUjt6bK63LxqC0uYQB7iu+xViJOxvp1s8b9/akpXVPVWjDTTsP980/0KYyMMe4U7F/aUo7wY+MsXA==", - "dev": true - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index 930591e..0000000 --- a/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "devDependencies": { - "@vicons/fa": "^0.12.0" - } -}