Skip to content

Commit

Permalink
fix: version getter
Browse files Browse the repository at this point in the history
  • Loading branch information
boojack committed May 17, 2022
1 parent 68bae1f commit 685bbc7
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-push-dev-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- "main"

jobs:
docker:
build-and-push-dev-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-push-release-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- "release/v*.*.*"

jobs:
docker:
build-and-push-release-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
## ⚓️ Deploy with Docker

```docker
docker run --name memos --publish 8080:8080 --volume ~/.memos/:/var/opt/memos -e mode=prod neosmemo/memos:0.0.1
docker run --name memos --publish 5230:8080 --volume ~/.memos/:/var/opt/memos -e mode=prod neosmemo/memos:0.0.1
```

If the `~/.memos/` does not have a `memos_prod.db` file, then `memos` will auto generate it.
Expand All @@ -45,7 +45,7 @@ Memos is built with a curated tech stack. It is optimized for developer experien

### Tech Stack

<img alt="tech stack" src="https://raw.githubusercontent.com/justmemos/memos/main/resources/tech-stack.png" width="320" />
<img alt="tech stack" src="https://raw.githubusercontent.com/justmemos/memos/main/resources/tech-stack.png" width="360" />

### Prerequisites

Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

18 changes: 1 addition & 17 deletions common/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,6 @@ func checkDSN(dataDir string) (string, error) {
return dataDir, nil
}

func getSystemVersion() string {
absPath, err := filepath.Abs("./VERSION")
if err != nil {
return "0.0.0"
}

data, err := os.ReadFile(absPath)
if err != nil {
return "0.0.0"
}

return string(data)
}

// GetDevProfile will return a profile for dev.
func GetProfile() *Profile {
mode := os.Getenv("mode")
Expand All @@ -79,12 +65,10 @@ func GetProfile() *Profile {

dsn := fmt.Sprintf("%s/memos_%s.db", dataDir, mode)

version := getSystemVersion()

return &Profile{
Mode: mode,
Port: port,
DSN: dsn,
Version: version,
Version: Version,
}
}
4 changes: 4 additions & 0 deletions common/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package common

// Version is the service current released version.
var Version = "0.0.1"

0 comments on commit 685bbc7

Please sign in to comment.