rename to ephemerup

This commit is contained in:
2023-03-29 13:24:01 +02:00
parent 737df3c802
commit e7ea396369
29 changed files with 85 additions and 85 deletions

View File

@@ -12,7 +12,7 @@ WORKDIR /work
COPY go.mod .
COPY . .
RUN go mod download
RUN make && strip cenod
RUN make && strip ephemerupd
FROM alpine:3.17
LABEL maintainer="Uploads Author <info@daemon.de>"
@@ -20,14 +20,14 @@ LABEL maintainer="Uploads Author <info@daemon.de>"
RUN install -o 1001 -g 1001 -d /data
WORKDIR /app
COPY --from=builder /work/cenod /app/cenod
COPY --from=builder /work/ephemerupd /app/ephemerupd
ENV CENOD_LISTEN=:8080
ENV CENOD_STORAGEDIR=/data
ENV CENOD_DBFILE=/data/bbolt.db
ENV CENOD_DEBUG=1
ENV EPHEMERUPD_LISTEN=:8080
ENV EPHEMERUPD_STORAGEDIR=/data
ENV EPHEMERUPD_DBFILE=/data/bbolt.db
ENV EPHEMERUPD_DEBUG=1
USER 1001:1001
EXPOSE 8080
VOLUME /data
CMD ["/app/cenod"]
CMD ["/app/ephemerupd"]

View File

@@ -27,7 +27,7 @@ COMMIT = $(shell git rev-parse --short=8 HEAD)
BUILD = $(shell date +%Y.%m.%d.%H%M%S)
VERSION := $(if $(filter $(BRANCH), development),$(version)-$(BRANCH)-$(COMMIT)-$(BUILD),$(version))
HAVE_POD := $(shell pod2text -h 2>/dev/null)
DAEMON := cenod
DAEMON := ephemerupd
all: cmd/formtemplate.go buildlocal buildlocalctl
@@ -35,7 +35,7 @@ buildlocalctl:
make -C upctl
buildlocal:
go build -ldflags "-X 'github.com/tlinden/cenophane/cfg.VERSION=$(VERSION)'" -o $(DAEMON)
go build -ldflags "-X 'github.com/tlinden/ephemerup/cfg.VERSION=$(VERSION)'" -o $(DAEMON)
buildimage: clean
docker-compose --verbose build
@@ -60,15 +60,15 @@ test:
singletest:
@echo "Call like this: ''make singletest TEST=TestX1 MOD=lib"
go test -run $(TEST) github.com/tlinden/cenophane/$(MOD)
go test -run $(TEST) github.com/tlinden/ephemerup/$(MOD)
cover-report:
go test ./... -cover -coverprofile=coverage.out
go tool cover -html=coverage.out
show-versions: buildlocal
@echo "### cenod version:"
@./cenod --version
@echo "### ephemerupd version:"
@./ephemerupd --version
@echo
@echo "### go module versions:"

View File

@@ -1,9 +1,9 @@
# Cenophane
# ephemerup
Simple standalone file upload server with expiration and commandline client.
## Introduction
**Cenophane** is a simple standalone file server where every uploaded
**ephemerup** is a simple standalone file server where every uploaded
file expires sooner or later. The server provides a RESTful API and
can be used easily with the commandline client `upctl`.
@@ -13,7 +13,7 @@ important enough to keep them around. Think of this szenario: you're
working for the network departement and there's a problem with your
routing. Tech support asks you to create a network trace and send it
to them. But you can't because the trace file is too large and
sensitive to be sent by email. This is where **Cenophane** comes to
sensitive to be sent by email. This is where **ephemerup** comes to
the rescue.
You upload the file, send the download url to the other party and -
@@ -21,11 +21,11 @@ assuming you've utilized the defaults - when they download it, it is
being deleted immediately from the server. But you can also set an
expire time, say 5 days or something like that.
The download urls generated by **Cenophane** consist of a unique
The download urls generated by **ephemerup** consist of a unique
onetime hash, so they are somewhat confident. However, if you're
uploading really sensitive data, you better encrypt it.
**Cenophane** also supports something we call an API Context. There
**ephemerup** also supports something we call an API Context. There
can be many such API contexts. Each of these has an associated token,
which has to be used by legitimate clients to authenticate and
authorize. A user can only manage uploads within that context. Think
@@ -60,17 +60,17 @@ releases available yet. You'll need a go build environment. Just run
There's a `Dockerfile` available for the server so you can build and run it using docker:
```
make buildimage
docker-compose run cenophane
docker-compose run ephemerup
```
Then use the client to test it.
## Server Usage
```
cenod -h
ephemerupd -h
--apikeys strings Api key[s] to allow access
-a, --apiprefix string API endpoint path (default "/api")
-n, --appname string App name to say hi as (default "cenod v0.0.1")
-n, --appname string App name to say hi as (default "ephemerupd v0.0.1")
-b, --bodylimit int Max allowed upload size in bytes (default 10250000000)
-c, --config string custom config file
-D, --dbfile string Bold database file to use (default "/tmp/uploads.db")
@@ -86,23 +86,23 @@ cenod -h
-v, --version Print program version
```
All flags can be set using environment variables, prefix the flag with `CENOD_` and uppercase it, eg:
All flags can be set using environment variables, prefix the flag with `EPHEMERUPD_` and uppercase it, eg:
```
CENOD_LISTEN=:8080
EPHEMERUPD_LISTEN=:8080
```
In addition it is possible to set api contexts using env vars (otherwise only possible using the config file):
```
CENOD_CONTEXT_SUPPORT="support:tymag-fycyh-gymof-dysuf-doseb-puxyx"
CENOD_CONTEXT_FOOBAR="foobar:U3VuIE1hciAxOSAxMjoyNTo1NyBQTSBDRVQgMjAyMwo"
EPHEMERUPD_CONTEXT_SUPPORT="support:tymag-fycyh-gymof-dysuf-doseb-puxyx"
EPHEMERUPD_CONTEXT_FOOBAR="foobar:U3VuIE1hciAxOSAxMjoyNTo1NyBQTSBDRVQgMjAyMwo"
```
Configuration can also be done using a config file (searched in the following locations):
- `/etc/cenod.hcl`
- `/usr/local/etc/cenod.hcl`
- `~/.config/cenod/cenod.hcl`
- `~/.cenod`
- `$(pwd)/cenod.hcl`
- `/etc/ephemerupd.hcl`
- `/usr/local/etc/ephemerupd.hcl`
- `~/.config/ephemerupd/ephemerupd.hcl`
- `~/.ephemerupd`
- `$(pwd)/ephemerupd.hcl`
Or using the flag `-c`. Sample config file:
```
@@ -131,7 +131,7 @@ super = "root"
The server serves the API under the following endpoint:
`http://SERVERNAME[:PORT]/api/v1` where SERVERNAME[:PORT] is the
argument to the `-l` commandline argument or the config option
`listen` or the environment variable `CENOD_LISTEN`.
`listen` or the environment variable `EPHEMERUPD_LISTEN`.
By default the server listens on any interface ip4 and ipv6 on TCP
port 8080. You can specify a server name or an ipaddress and a
@@ -258,7 +258,7 @@ endpoint = "http://localhost:8080/api/v1"
apikey = "970b391f22f515d96b3e9b86a2c62c627968828e47b356994d2e583188b4190a"
```
The `endpoint` is the **Cenophane** server running somewhere and the
The `endpoint` is the **ephemerup** server running somewhere and the
`apikey` is the token you got from the server operator..

View File

@@ -23,8 +23,8 @@ import (
"errors"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/keyauth/v2"
"github.com/tlinden/cenophane/cfg"
"github.com/tlinden/cenophane/common"
"github.com/tlinden/ephemerup/cfg"
"github.com/tlinden/ephemerup/common"
)
// these vars can be savely global, since they don't change ever

View File

@@ -21,8 +21,8 @@ import (
"fmt"
//"github.com/alecthomas/repr"
"encoding/json"
"github.com/tlinden/cenophane/cfg"
"github.com/tlinden/cenophane/common"
"github.com/tlinden/ephemerup/cfg"
"github.com/tlinden/ephemerup/common"
bolt "go.etcd.io/bbolt"
"path/filepath"
"time"

View File

@@ -19,8 +19,8 @@ package api
import (
"fmt"
"github.com/tlinden/cenophane/cfg"
"github.com/tlinden/cenophane/common"
"github.com/tlinden/ephemerup/cfg"
"github.com/tlinden/ephemerup/common"
//"github.com/alecthomas/repr"
bolt "go.etcd.io/bbolt"
)

View File

@@ -20,8 +20,8 @@ package api
import (
//"github.com/alecthomas/repr"
"github.com/maxatome/go-testdeep/td"
"github.com/tlinden/cenophane/cfg"
"github.com/tlinden/cenophane/common"
"github.com/tlinden/ephemerup/cfg"
"github.com/tlinden/ephemerup/common"
"os"
"testing"
"time"

View File

@@ -21,8 +21,8 @@ import (
"archive/zip"
"errors"
"github.com/gofiber/fiber/v2"
"github.com/tlinden/cenophane/cfg"
"github.com/tlinden/cenophane/common"
"github.com/tlinden/ephemerup/cfg"
"github.com/tlinden/ephemerup/common"
"io"
"mime/multipart"
"os"

View File

@@ -21,8 +21,8 @@ import (
//"github.com/alecthomas/repr"
"github.com/gofiber/fiber/v2"
"github.com/google/uuid"
"github.com/tlinden/cenophane/cfg"
"github.com/tlinden/cenophane/common"
"github.com/tlinden/ephemerup/cfg"
"github.com/tlinden/ephemerup/common"
"bytes"
"html/template"

View File

@@ -19,7 +19,7 @@ package api
import (
"fmt"
"github.com/tlinden/cenophane/cfg"
"github.com/tlinden/ephemerup/cfg"
"net/smtp"
)

View File

@@ -26,8 +26,8 @@ import (
"github.com/gofiber/fiber/v2/middleware/requestid"
"github.com/gofiber/fiber/v2/middleware/session"
"github.com/gofiber/keyauth/v2"
"github.com/tlinden/cenophane/cfg"
"github.com/tlinden/cenophane/common"
"github.com/tlinden/ephemerup/cfg"
"github.com/tlinden/ephemerup/common"
)
// sessions are context specific and can be global savely
@@ -162,7 +162,7 @@ func SetupServer(conf *cfg.Config) *fiber.App {
StrictRouting: true,
Immutable: true,
Prefork: conf.Prefork,
ServerHeader: "Cenophane Server",
ServerHeader: "ephemerup Server",
AppName: conf.AppName,
BodyLimit: conf.BodyLimit,
Network: conf.Network,

View File

@@ -21,8 +21,8 @@ import (
//"github.com/alecthomas/repr"
"github.com/gofiber/fiber/v2"
"github.com/google/uuid"
"github.com/tlinden/cenophane/cfg"
"github.com/tlinden/cenophane/common"
"github.com/tlinden/ephemerup/cfg"
"github.com/tlinden/ephemerup/common"
"fmt"
"os"

View File

@@ -20,8 +20,8 @@ package api
import (
"fmt"
"github.com/gofiber/fiber/v2"
"github.com/tlinden/cenophane/cfg"
"github.com/tlinden/cenophane/common"
"github.com/tlinden/ephemerup/cfg"
"github.com/tlinden/ephemerup/common"
"time"
)

View File

@@ -83,7 +83,7 @@ func Getversion() string {
// main branch, and cfg.Version-$branch-$lastcommit-$date on
// development branch
return fmt.Sprintf("This is cenophane server version %s", VERSION)
return fmt.Sprintf("This is ephemerup server version %s", VERSION)
}
func (c *Config) GetVersion() string {

View File

@@ -29,8 +29,8 @@ import (
flag "github.com/spf13/pflag"
"github.com/alecthomas/repr"
"github.com/tlinden/cenophane/api"
"github.com/tlinden/cenophane/cfg"
"github.com/tlinden/ephemerup/api"
"github.com/tlinden/ephemerup/cfg"
"io/ioutil"
"os"
@@ -72,7 +72,7 @@ func Execute() error {
f.BoolVarP(&conf.V6only, "ipv6", "6", false, "Only listen on ipv6")
f.BoolVarP(&conf.Prefork, "prefork", "p", false, "Prefork server threads")
f.StringVarP(&conf.AppName, "appname", "n", "cenod "+conf.GetVersion(), "App name to say hi as")
f.StringVarP(&conf.AppName, "appname", "n", "ephemerupd "+conf.GetVersion(), "App name to say hi as")
f.IntVarP(&conf.BodyLimit, "bodylimit", "b", 10250000000, "Max allowed upload size in bytes")
f.Parse(os.Args[1:])
@@ -92,10 +92,10 @@ func Execute() error {
configfiles = []string{configfile}
} else {
configfiles = []string{
"/etc/cenod.hcl", "/usr/local/etc/cenod.hcl", // unix variants
filepath.Join(os.Getenv("HOME"), ".config", "cenod", "cenod.hcl"),
filepath.Join(os.Getenv("HOME"), ".cenod"),
"cenod.hcl",
"/etc/ephemerupd.hcl", "/usr/local/etc/ephemerupd.hcl", // unix variants
filepath.Join(os.Getenv("HOME"), ".config", "ephemerupd", "ephemerupd.hcl"),
filepath.Join(os.Getenv("HOME"), ".ephemerupd"),
"ephemerupd.hcl",
}
}
@@ -109,9 +109,9 @@ func Execute() error {
}
// env overrides config file
k.Load(env.Provider("CENOD_", ".", func(s string) string {
k.Load(env.Provider("EPHEMERUPD_", ".", func(s string) string {
return strings.Replace(strings.ToLower(
strings.TrimPrefix(s, "CENOD_")), "_", ".", -1)
strings.TrimPrefix(s, "EPHEMERUPD_")), "_", ".", -1)
}), nil)
// command line overrides env
@@ -175,11 +175,11 @@ func Execute() error {
Multiple env vars are supported in this format:
CENOD_CONTEXT_$(NAME)="<context>:<key>"
EPHEMERUPD_CONTEXT_$(NAME)="<context>:<key>"
eg:
CENOD_CONTEXT_SUPPORT="support:tymag-fycyh-gymof-dysuf-doseb-puxyx"
EPHEMERUPD_CONTEXT_SUPPORT="support:tymag-fycyh-gymof-dysuf-doseb-puxyx"
^^^^^^^- doesn't matter.
Modifies cfg.Config directly
@@ -189,7 +189,7 @@ func GetApicontextsFromEnv(conf *cfg.Config) {
for _, envvar := range os.Environ() {
pair := strings.SplitN(envvar, "=", 2)
if strings.HasPrefix(pair[0], "CENOD_CONTEXT_") {
if strings.HasPrefix(pair[0], "EPHEMERUPD_CONTEXT_") {
c := strings.SplitN(pair[1], ":", 2)
if len(c) == 2 {
contexts = append(contexts, cfg.Apicontext{Context: c[0], Key: c[1]})

View File

@@ -1,3 +1,3 @@
module github.com/tlinden/cenophane/common
module github.com/tlinden/ephemerup/common
go 1.18

View File

@@ -1,6 +1,6 @@
version: "3.9"
services:
cenophane:
ephemerup:
build: .
ports:
- "8080:8080"

6
go.mod
View File

@@ -1,4 +1,4 @@
module github.com/tlinden/cenophane
module github.com/tlinden/ephemerup
go 1.18
@@ -13,7 +13,7 @@ require (
github.com/knadh/koanf/providers/posflag v0.1.0
github.com/knadh/koanf/v2 v2.0.0
github.com/spf13/pflag v1.0.5
github.com/tlinden/cenophane/common v0.0.0-00010101000000-000000000000
github.com/tlinden/ephemerup/common v0.0.0-00010101000000-000000000000
go.etcd.io/bbolt v1.3.7
)
@@ -42,4 +42,4 @@ require (
golang.org/x/sys v0.4.0 // indirect
)
replace github.com/tlinden/cenophane/common => ./common
replace github.com/tlinden/ephemerup/common => ./common

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package main
import (
"github.com/tlinden/cenophane/cmd"
"github.com/tlinden/ephemerup/cmd"
"log"
)

View File

@@ -33,7 +33,7 @@ all: buildlocal
buildlocal:
go build -ldflags "-X 'github.com/tlinden/cenophane/upctl/cfg.VERSION=$(VERSION)'"
go build -ldflags "-X 'github.com/tlinden/ephemerup/upctl/cfg.VERSION=$(VERSION)'"
release:
./mkrel.sh $(tool) $(version)

View File

@@ -19,8 +19,8 @@ package cmd
import (
//"errors"
"github.com/spf13/cobra"
"github.com/tlinden/cenophane/upctl/cfg"
"github.com/tlinden/cenophane/upctl/lib"
"github.com/tlinden/ephemerup/upctl/cfg"
"github.com/tlinden/ephemerup/upctl/lib"
"os"
)

View File

@@ -19,8 +19,8 @@ package cmd
import (
"errors"
"github.com/spf13/cobra"
"github.com/tlinden/cenophane/upctl/cfg"
"github.com/tlinden/cenophane/upctl/lib"
"github.com/tlinden/ephemerup/upctl/cfg"
"github.com/tlinden/ephemerup/upctl/lib"
"os"
)

View File

@@ -22,7 +22,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"
"github.com/tlinden/cenophane/upctl/cfg"
"github.com/tlinden/ephemerup/upctl/cfg"
"os"
"strings"
)

View File

@@ -1,4 +1,4 @@
module github.com/tlinden/cenophane/upctl
module github.com/tlinden/ephemerup/upctl
go 1.18
@@ -10,7 +10,7 @@ require (
github.com/spf13/cobra v1.6.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.15.0
github.com/tlinden/cenophane/common v0.0.0-00010101000000-000000000000
github.com/tlinden/ephemerup/common v0.0.0-00010101000000-000000000000
)
require (
@@ -51,4 +51,4 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)
replace github.com/tlinden/cenophane/common => ../common
replace github.com/tlinden/ephemerup/common => ../common

View File

@@ -25,8 +25,8 @@ import (
"github.com/imroc/req/v3"
"github.com/jarcoal/httpmock"
"github.com/schollz/progressbar/v3"
"github.com/tlinden/cenophane/common"
"github.com/tlinden/cenophane/upctl/cfg"
"github.com/tlinden/ephemerup/common"
"github.com/tlinden/ephemerup/upctl/cfg"
"io"
"mime"
"os"

View File

@@ -22,7 +22,7 @@ import (
"bytes"
"fmt"
"github.com/jarcoal/httpmock"
"github.com/tlinden/cenophane/upctl/cfg"
"github.com/tlinden/ephemerup/upctl/cfg"
"io/ioutil"
"net/http"
"os"
@@ -49,7 +49,7 @@ type Unit struct {
method string // method to use
}
// simulate our cenophane server
// simulate our ephemerup server
func Intercept(tt Unit) {
httpmock.RegisterResponder(tt.method, endpoint+tt.route,
func(request *http.Request) (*http.Response, error) {

View File

@@ -23,7 +23,7 @@ import (
"fmt"
"github.com/imroc/req/v3"
"github.com/olekukonko/tablewriter"
"github.com/tlinden/cenophane/common"
"github.com/tlinden/ephemerup/common"
"io"
"strings"
"time"

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package main
import (
"github.com/tlinden/cenophane/upctl/cmd"
"github.com/tlinden/ephemerup/upctl/cmd"
)
func main() {