Skip to content

Commit

Permalink
🚀 publish v0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
itmisx committed Aug 29, 2022
1 parent 2e9fde3 commit 7fc5138
Show file tree
Hide file tree
Showing 389 changed files with 186,678 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS_Store
build/release
upload
logs
web_src/dist
web_src/node_modules
web_src/yarn.lock
43 changes: 41 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,41 @@
# znj
面向中小团队,基于文档的项目协作工具,免费开源
# ZNJ[智能记] 中小团队协作工具

#### 🎉 简介

可以简单替代 tower 的基于文档的团队协作工具

- 支持待办事项管理
- 支持项目任务管理
- 支持 markdown,流程图文档

#### 🚀 源码安装

```bash
git clone https://github.com/itmisx/znj
cd znj/web_src
yarn install
yarn build
cd ../
go mod tidy
GOOS=linux GOARCH=amd64 go build -o znj main.go
# 可以自定义配置 /etc/znj.yaml
./znj
```

#### 🚀 Docker

```bash
git clone https://github.com/itmisx/znj
cd znj/docker
# 自定义配置文件
# 编辑docker-compose.yaml
# volumes:
# - ./etc/znj.yaml:/etc/znj.yaml
docker-compose up -d
```

#### 🎉 截图

![1](doc/screenshot/img-1.jpg)

#### LICENSE
10 changes: 10 additions & 0 deletions build/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
git clone https://github.com/itmisx/znj
cd znj/web_src
yarn
yarn build
cd ../
go mod tidy
rm -rf build/release/*
GOOS=linux GOARCH=amd64 go build -o build/release/znj main.go
cp -r etc build/release
docker build -t znj:0.0.1 .
36 changes: 36 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package config

import (
"github.com/itmisx/gormx"
"github.com/itmisx/logger"
"github.com/itmisx/redisx"
"github.com/spf13/viper"
)

var Conf struct {
HTTPPort string `mapstructure:"http_port"`
Mysql gormx.Config `mapstructure:"mysql"`
Redis redisx.Config `mapstructure:"redis"`
Logger logger.Config `mapstructure:"logger"`
DefalutLang string `mapstructure:"default_lang"`
AllowMethods []string `mapstructure:"allow_methods"`
AllowHeaders []string `mapstructure:"allow_headers"`
AdminUser struct {
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
} `mapstructure:"admin_user"`
}

// 解析配置
func ParseConf() {
vp := viper.New()
vp.SetConfigName("znj")
vp.SetConfigType("yaml")
vp.AddConfigPath("./etc")
vp.AddConfigPath("/etc")
err := vp.ReadInConfig()
if err != nil {
panic(err.Error())
}
vp.Unmarshal(&Conf)
}
22 changes: 22 additions & 0 deletions config/mysql.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package config

import (
"github.com/itmisx/gormx"
"gorm.io/gorm"
)

var _db *gorm.DB

// MysqlInit mysql数据库初始化
func MysqlInit(cfg gormx.Config) (err error) {
_db, err = gormx.New(cfg)
if err != nil {
panic(err)
}
return
}

// 获取一个数据库对象
func NewDB() *gorm.DB {
return _db
}
16 changes: 16 additions & 0 deletions config/redis.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package config

import "github.com/itmisx/redisx"

// 实例变量
var _cli redisx.Client

// RedisInit
func RedisInit(conf redisx.Config) {
_cli = redisx.New(conf)
}

// NewRDB 获取redis链接
func NewRDB() redisx.Client {
return _cli
}
Loading

0 comments on commit 7fc5138

Please sign in to comment.