From e7ea396369bb87924e9a9084fe8588001348c4ba Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Wed, 29 Mar 2023 13:24:01 +0200 Subject: [PATCH] rename to ephemerup --- Dockerfile | 14 +++++++------- Makefile | 10 +++++----- README.md | 38 +++++++++++++++++++------------------- api/auth.go | 4 ++-- api/cleaner.go | 4 ++-- api/db.go | 4 ++-- api/db_test.go | 4 ++-- api/fileio.go | 4 ++-- api/form_handlers.go | 4 ++-- api/mail.go | 2 +- api/server.go | 6 +++--- api/upload_handlers.go | 4 ++-- api/utils.go | 4 ++-- cfg/config.go | 2 +- cmd/root.go | 24 ++++++++++++------------ common/go.mod | 2 +- docker-compose.yml | 2 +- cenod.hcl => ephemerup.hcl | 0 go.mod | 6 +++--- main.go | 2 +- upctl/Makefile | 2 +- upctl/cmd/formcommands.go | 4 ++-- upctl/cmd/maincommands.go | 4 ++-- upctl/cmd/root.go | 2 +- upctl/go.mod | 6 +++--- upctl/lib/client.go | 4 ++-- upctl/lib/client_test.go | 4 ++-- upctl/lib/output.go | 2 +- upctl/main.go | 2 +- 29 files changed, 85 insertions(+), 85 deletions(-) rename cenod.hcl => ephemerup.hcl (100%) diff --git a/Dockerfile b/Dockerfile index baf7e11..5b90ceb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 " @@ -20,14 +20,14 @@ LABEL maintainer="Uploads Author " 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"] diff --git a/Makefile b/Makefile index 57bd194..a1f589d 100644 --- a/Makefile +++ b/Makefile @@ -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:" diff --git a/README.md b/README.md index 0f2b1c1..66f2fe8 100644 --- a/README.md +++ b/README.md @@ -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.. diff --git a/api/auth.go b/api/auth.go index 8b259d8..6602be2 100644 --- a/api/auth.go +++ b/api/auth.go @@ -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 diff --git a/api/cleaner.go b/api/cleaner.go index 650bf9e..c769a1c 100644 --- a/api/cleaner.go +++ b/api/cleaner.go @@ -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" diff --git a/api/db.go b/api/db.go index de8c9aa..c3f43d7 100644 --- a/api/db.go +++ b/api/db.go @@ -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" ) diff --git a/api/db_test.go b/api/db_test.go index 8ecf90f..571a08e 100644 --- a/api/db_test.go +++ b/api/db_test.go @@ -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" diff --git a/api/fileio.go b/api/fileio.go index f0d446b..8301e33 100644 --- a/api/fileio.go +++ b/api/fileio.go @@ -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" diff --git a/api/form_handlers.go b/api/form_handlers.go index 5f466cf..d55f244 100644 --- a/api/form_handlers.go +++ b/api/form_handlers.go @@ -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" diff --git a/api/mail.go b/api/mail.go index 95e72e3..894eadb 100644 --- a/api/mail.go +++ b/api/mail.go @@ -19,7 +19,7 @@ package api import ( "fmt" - "github.com/tlinden/cenophane/cfg" + "github.com/tlinden/ephemerup/cfg" "net/smtp" ) diff --git a/api/server.go b/api/server.go index 31189ef..4ec61d3 100644 --- a/api/server.go +++ b/api/server.go @@ -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, diff --git a/api/upload_handlers.go b/api/upload_handlers.go index 8a1533e..46f13d8 100644 --- a/api/upload_handlers.go +++ b/api/upload_handlers.go @@ -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" diff --git a/api/utils.go b/api/utils.go index 19e37bb..f662c9b 100644 --- a/api/utils.go +++ b/api/utils.go @@ -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" ) diff --git a/cfg/config.go b/cfg/config.go index d720492..dfbf732 100644 --- a/cfg/config.go +++ b/cfg/config.go @@ -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 { diff --git a/cmd/root.go b/cmd/root.go index 3a4f901..8834071 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -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)=":" + EPHEMERUPD_CONTEXT_$(NAME)=":" 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]}) diff --git a/common/go.mod b/common/go.mod index 06d829b..e70a9b7 100644 --- a/common/go.mod +++ b/common/go.mod @@ -1,3 +1,3 @@ -module github.com/tlinden/cenophane/common +module github.com/tlinden/ephemerup/common go 1.18 diff --git a/docker-compose.yml b/docker-compose.yml index f2933be..a2f52a9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ version: "3.9" services: - cenophane: + ephemerup: build: . ports: - "8080:8080" diff --git a/cenod.hcl b/ephemerup.hcl similarity index 100% rename from cenod.hcl rename to ephemerup.hcl diff --git a/go.mod b/go.mod index 0f5be47..da68222 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/main.go b/main.go index 720e918..6957212 100644 --- a/main.go +++ b/main.go @@ -18,7 +18,7 @@ along with this program. If not, see . package main import ( - "github.com/tlinden/cenophane/cmd" + "github.com/tlinden/ephemerup/cmd" "log" ) diff --git a/upctl/Makefile b/upctl/Makefile index dbadb30..636da5d 100644 --- a/upctl/Makefile +++ b/upctl/Makefile @@ -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) diff --git a/upctl/cmd/formcommands.go b/upctl/cmd/formcommands.go index e655d8c..b95d192 100644 --- a/upctl/cmd/formcommands.go +++ b/upctl/cmd/formcommands.go @@ -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" ) diff --git a/upctl/cmd/maincommands.go b/upctl/cmd/maincommands.go index 45093a6..180bc01 100644 --- a/upctl/cmd/maincommands.go +++ b/upctl/cmd/maincommands.go @@ -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" ) diff --git a/upctl/cmd/root.go b/upctl/cmd/root.go index 6f9ec06..b2e5b46 100644 --- a/upctl/cmd/root.go +++ b/upctl/cmd/root.go @@ -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" ) diff --git a/upctl/go.mod b/upctl/go.mod index 6f997ff..9b3b246 100644 --- a/upctl/go.mod +++ b/upctl/go.mod @@ -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 diff --git a/upctl/lib/client.go b/upctl/lib/client.go index 0e2309d..2850b53 100644 --- a/upctl/lib/client.go +++ b/upctl/lib/client.go @@ -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" diff --git a/upctl/lib/client_test.go b/upctl/lib/client_test.go index 6876d18..b2fc1fb 100644 --- a/upctl/lib/client_test.go +++ b/upctl/lib/client_test.go @@ -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) { diff --git a/upctl/lib/output.go b/upctl/lib/output.go index a12fefa..63c8861 100644 --- a/upctl/lib/output.go +++ b/upctl/lib/output.go @@ -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" diff --git a/upctl/main.go b/upctl/main.go index c11a498..a7aa748 100644 --- a/upctl/main.go +++ b/upctl/main.go @@ -18,7 +18,7 @@ along with this program. If not, see . package main import ( - "github.com/tlinden/cenophane/upctl/cmd" + "github.com/tlinden/ephemerup/upctl/cmd" ) func main() {