Renamed project from swd to daffy
This commit is contained in:
parent
5a284b4c24
commit
99360e877a
8 changed files with 52 additions and 51 deletions
34
Readme.md
34
Readme.md
|
@ -1,9 +1,9 @@
|
|||
[![Build Status](https://travis-ci.org/micromata/swd.svg?branch=master)](https://travis-ci.org/micromata/swd)
|
||||
[![Go Report](https://goreportcard.com/badge/github.com/micromata/swd)](https://goreportcard.com/report/github.com/micromata/swd)
|
||||
[![Build Status](https://travis-ci.org/micromata/daffy.svg?branch=master)](https://travis-ci.org/micromata/daffy)
|
||||
[![Go Report](https://goreportcard.com/badge/github.com/micromata/daffy)](https://goreportcard.com/report/github.com/micromata/daffy)
|
||||
|
||||
# swd - The simple webdav server
|
||||
# daffy - The simple webdav server
|
||||
|
||||
*swd* is a simple webdav server that provides the following features:
|
||||
*daffy* is a simple webdav server that provides the following features:
|
||||
|
||||
- Single binary that runs under Windows, Linux and OSX.
|
||||
- Authentication via HTTP-Basic.
|
||||
|
@ -32,12 +32,12 @@ It perfectly fits if you would like to give some people the possibility to uploa
|
|||
|
||||
## Configuration
|
||||
|
||||
The configuration is done in form of a yaml file. _swd_ will scan the
|
||||
The configuration is done in form of a yaml file. _daffy_ will scan the
|
||||
following locations for the presence of a `config.yaml` in the following
|
||||
order:
|
||||
|
||||
- The directory `./config`
|
||||
- The directory `$HOME/.swd`
|
||||
- The directory `$HOME/.daffy`
|
||||
- The current working directory `.`
|
||||
|
||||
### First steps
|
||||
|
@ -89,7 +89,7 @@ doesn't need a passphrase. Otherwise starting the server will fail.
|
|||
|
||||
### Behind a proxy
|
||||
|
||||
_swd_ will also work behind a reverse proxy. Here is an example
|
||||
_daffy_ will also work behind a reverse proxy. Here is an example
|
||||
configuration with `apache2 httpd`'s `mod_proxy`:
|
||||
|
||||
<Location /webdav>
|
||||
|
@ -99,9 +99,9 @@ configuration with `apache2 httpd`'s `mod_proxy`:
|
|||
|
||||
### User management
|
||||
|
||||
User management in *swd* is very simple. Each user in the `config.yaml` MUST have a password and CAN have a subdirectory.
|
||||
User management in *daffy* is very simple. Each user in the `config.yaml` MUST have a password and CAN have a subdirectory.
|
||||
|
||||
The password must be in form of a BCrypt hash. You can generate one calling the shipped cli tool `swdcli passwd`.
|
||||
The password must be in form of a BCrypt hash. You can generate one calling the shipped cli tool `daffycli pasdaffy`.
|
||||
|
||||
If a subdirectory is configured for a user, the user is jailed within it and can't see anything that exists outside of this directory. If no subdirectory is configured for an user, the user can see and modify all files within the base directory.
|
||||
|
||||
|
@ -150,9 +150,9 @@ There is no need to restart the server itself, if you're editing the user or log
|
|||
|
||||
### Binary installation
|
||||
|
||||
You can check out the [releases page](https://github.com/micromata/swd/releases) for the latest precompiled binaries.
|
||||
You can check out the [releases page](https://github.com/micromata/daffy/releases) for the latest precompiled binaries.
|
||||
|
||||
### Build from sources
|
||||
### Build from sources
|
||||
|
||||
#### Setup
|
||||
|
||||
|
@ -166,17 +166,17 @@ mkdir -p $GOPATH/src/github.com/micromata/ && cd $GOPATH/src/github.com/micromat
|
|||
3. Clone the repository (or your fork)
|
||||
|
||||
```
|
||||
git clone git@github.com:micromata/swd.git
|
||||
git clone git@github.com:micromata/daffy.git
|
||||
```
|
||||
|
||||
To build and install from sources you have two major possibilites:
|
||||
|
||||
#### go install
|
||||
|
||||
You can use the plain go toolchain and install the project to your `$GOPATH` via:
|
||||
You can use the plain go toolchain and install the project to your `$GOPATH` via:
|
||||
|
||||
```
|
||||
cd $GOPATH/src/github.com/micromata/swd && go install ./...
|
||||
cd $GOPATH/src/github.com/micromata/daffy && go install ./...
|
||||
```
|
||||
|
||||
#### magefile
|
||||
|
@ -192,12 +192,12 @@ Please ensure you've got [mage](https://magefile.org) installed. This can be don
|
|||
Now you can call `mage install` to build and install the binaries. If you just call `mage`, you'll get a list of possible targets:
|
||||
|
||||
Targets:
|
||||
build Builds swd and swdcli and moves it to the dist directory
|
||||
buildReleases Builds swd and swdcli for different OS and package them to a zip file for each os
|
||||
build Builds daffy and daffycli and moves it to the dist directory
|
||||
buildReleases Builds daffy and daffycli for different OS and package them to a zip file for each os
|
||||
check Runs golint and go tool vet on each .go file.
|
||||
clean Removes the dist directory
|
||||
fmt Formats the code via gofmt
|
||||
install Installs swd and swdcli to your $GOPATH/bin folder
|
||||
install Installs daffy and daffycli to your $GOPATH/bin folder
|
||||
installDeps Runs dep ensure and installs additional dependencies.
|
||||
|
||||
## Connecting
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package app
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/fsnotify/fsnotify"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spf13/viper"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// Config represents the configuration of the server application.
|
||||
|
@ -50,6 +50,7 @@ func ParseConfig() *Config {
|
|||
viper.SetConfigName("config")
|
||||
viper.AddConfigPath("./config")
|
||||
viper.AddConfigPath("$HOME/.swd")
|
||||
viper.AddConfigPath("$HOME/.daffy")
|
||||
viper.AddConfigPath(".")
|
||||
|
||||
err := viper.ReadInConfig()
|
||||
|
|
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/micromata/swd/app"
|
||||
"github.com/micromata/daffy/app"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"golang.org/x/net/webdav"
|
||||
syslog "log"
|
7
cmd/daffycli/main.go
Normal file
7
cmd/daffycli/main.go
Normal file
|
@ -0,0 +1,7 @@
|
|||
package main
|
||||
|
||||
import "github.com/micromata/daffy/cmd/daffycli/subcmd"
|
||||
|
||||
func main() {
|
||||
subcmd.Execute()
|
||||
}
|
|
@ -10,7 +10,7 @@ import (
|
|||
"syscall"
|
||||
)
|
||||
|
||||
var passwdCmd = &cobra.Command{
|
||||
var pasdaffyCmd = &cobra.Command{
|
||||
Use: "passwd",
|
||||
Short: "Generates a BCrypt hash of a given input string",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
|
@ -47,5 +47,5 @@ func readPassword() []byte {
|
|||
}
|
||||
|
||||
func init() {
|
||||
RootCmd.AddCommand(passwdCmd)
|
||||
RootCmd.AddCommand(pasdaffyCmd)
|
||||
}
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
// RootCmd represents the base command when called without any subcommands
|
||||
var RootCmd = &cobra.Command{
|
||||
Use: "swdcli",
|
||||
Use: "daffycli",
|
||||
Short: "A cli for the simple webdav server",
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
package main
|
||||
|
||||
import "github.com/micromata/swd/cmd/swdcli/subcmd"
|
||||
|
||||
func main() {
|
||||
subcmd.Execute()
|
||||
}
|
44
magefile.go
44
magefile.go
|
@ -28,7 +28,7 @@ type target struct {
|
|||
goarch string
|
||||
}
|
||||
|
||||
// Build Builds swd and swdcli and moves it to the dist directory
|
||||
// Build Builds daffy and daffycli and moves it to the dist directory
|
||||
func Build() error {
|
||||
mg.Deps(InstallDeps)
|
||||
mg.Deps(Clean)
|
||||
|
@ -47,7 +47,7 @@ func Build() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// BuildReleases Builds swd and swdcli for different OS and package them to a zip file for each os
|
||||
// BuildReleases Builds daffy and daffycli for different OS and package them to a zip file for each os
|
||||
func BuildReleases() error {
|
||||
mg.Deps(Clean)
|
||||
|
||||
|
@ -61,20 +61,20 @@ func BuildReleases() error {
|
|||
|
||||
for _, t := range targets {
|
||||
fmt.Printf("Building for OS %s and architecture %s\n", t.goos, t.goarch)
|
||||
swd, swdCli, _ := buildSpecific(t)
|
||||
daffy, daffyCli, _ := buildSpecific(t)
|
||||
|
||||
files := []string{
|
||||
swd,
|
||||
swdCli,
|
||||
daffy,
|
||||
daffyCli,
|
||||
"Readme.md",
|
||||
filepath.Join("examples", "config-sample.yaml"),
|
||||
}
|
||||
|
||||
archiveName := fmt.Sprintf("swd-%s-%s.zip", t.goos, t.goarch)
|
||||
archiveName := fmt.Sprintf("daffy-%s-%s.zip", t.goos, t.goarch)
|
||||
zipFiles(filepath.Join("dist", archiveName), files)
|
||||
|
||||
os.Remove(swd)
|
||||
os.Remove(swdCli)
|
||||
os.Remove(daffy)
|
||||
os.Remove(daffyCli)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -132,7 +132,7 @@ func Check() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Install Installs swd and swdcli to your $GOPATH/bin folder
|
||||
// Install Installs daffy and daffycli to your $GOPATH/bin folder
|
||||
func Install() error {
|
||||
mg.Deps(InstallDeps)
|
||||
|
||||
|
@ -179,31 +179,31 @@ func buildSpecific(t target) (string, string, error) {
|
|||
env = append(env, fmt.Sprintf("GOARCH=%s", t.goarch))
|
||||
}
|
||||
|
||||
swdSource := filepath.Join("cmd", "swd", "main.go")
|
||||
swdExe := filepath.Join(DIST, "swd")
|
||||
daffySource := filepath.Join("cmd", "daffy", "main.go")
|
||||
daffyExe := filepath.Join(DIST, "daffy")
|
||||
if t.goos == "windows" {
|
||||
swdExe += ".exe"
|
||||
daffyExe += ".exe"
|
||||
}
|
||||
swdCommand := exec.Command("go", "build", "-o", swdExe, swdSource)
|
||||
swdCommand.Env = env
|
||||
err := swdCommand.Run()
|
||||
daffyCommand := exec.Command("go", "build", "-o", daffyExe, daffySource)
|
||||
daffyCommand.Env = env
|
||||
err := daffyCommand.Run()
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
|
||||
swdCliSource := filepath.Join("cmd", "swdcli", "main.go")
|
||||
swdCliExe := filepath.Join(DIST, "swdcli")
|
||||
daffyCliSource := filepath.Join("cmd", "daffycli", "main.go")
|
||||
daffyCliExe := filepath.Join(DIST, "daffycli")
|
||||
if t.goos == "windows" {
|
||||
swdCliExe += ".exe"
|
||||
daffyCliExe += ".exe"
|
||||
}
|
||||
swdCliCommand := exec.Command("go", "build", "-o", swdCliExe, swdCliSource)
|
||||
swdCliCommand.Env = env
|
||||
err = swdCliCommand.Run()
|
||||
daffyCliCommand := exec.Command("go", "build", "-o", daffyCliExe, daffyCliSource)
|
||||
daffyCliCommand.Env = env
|
||||
err = daffyCliCommand.Run()
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
|
||||
return swdExe, swdCliExe, nil
|
||||
return daffyExe, daffyCliExe, nil
|
||||
}
|
||||
|
||||
// zipFiles compresses one or many files into a single zip archive file.
|
||||
|
|
Loading…
Reference in a new issue