Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions .github/workflows/ci-dgraph-oss-build.yml

This file was deleted.

9 changes: 0 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ dgraph:
dgraph-coverage:
$(MAKE) -w -C dgraph test-coverage-binary

.PHONY: oss
oss:
$(MAKE) BUILD_TAGS=oss

.PHONY: version
version:
@echo Dgraph: ${BUILD_VERSION}
Expand All @@ -48,10 +44,6 @@ install:
@echo "Installing Dgraph..."; \
$(MAKE) -C dgraph install; \

.PHONY: install_oss oss_install
install_oss oss_install:
$(MAKE) BUILD_TAGS=oss,jemalloc install

.PHONY: uninstall
uninstall:
@echo "Uninstalling Dgraph ..."; \
Expand Down Expand Up @@ -105,7 +97,6 @@ help:
@echo
@echo Build commands:
@echo " make [all] - Build all targets [EE]"
@echo " make oss - Build all targets [OSS]"
@echo " make dgraph - Build dgraph binary"
@echo " make install - Install all targets"
@echo " make uninstall - Uninstall known targets"
Expand Down
45 changes: 45 additions & 0 deletions dgraph/cmd/alpha/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/pkg/errors"
"google.golang.org/grpc/metadata"
jsonpb "google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"

"github.com/dgraph-io/dgo/v240/protos/api"
"github.com/hypermodeinc/dgraph/v24/dql"
Expand Down Expand Up @@ -133,6 +134,50 @@ func parseDuration(r *http.Request, name string) (time.Duration, error) {
return durationValue, nil
}

func loginHandler(w http.ResponseWriter, r *http.Request) {
if commonHandler(w, r) {
return
}

// Pass in PoorMan's auth, IP information if present.
ctx := x.AttachRemoteIP(context.Background(), r)
ctx = x.AttachAuthToken(ctx, r)

body := readRequest(w, r)
loginReq := api.LoginRequest{}
if err := json.Unmarshal(body, &loginReq); err != nil {
x.SetStatusWithData(w, x.Error, err.Error())
return
}

resp, err := (&edgraph.Server{}).Login(ctx, &loginReq)
if err != nil {
x.SetStatusWithData(w, x.ErrorInvalidRequest, err.Error())
return
}

jwt := &api.Jwt{}
if err := proto.Unmarshal(resp.Json, jwt); err != nil {
Comment thread
mangalaman93 marked this conversation as resolved.
x.SetStatusWithData(w, x.Error, err.Error())
}

response := map[string]interface{}{}
mp := make(map[string]string)
mp["accessJWT"] = jwt.AccessJwt
mp["refreshJWT"] = jwt.RefreshJwt
response["data"] = mp

js, err := json.Marshal(response)
if err != nil {
x.SetStatusWithData(w, x.Error, err.Error())
return
}

if _, err := x.WriteResponse(w, r, js); err != nil {
glog.Errorf("Error while writing response: %v", err)
}
}

// This method should just build the request and proxy it to the Query method of dgraph.Server.
// It can then encode the response as appropriate before sending it back to the user.
func queryHandler(w http.ResponseWriter, r *http.Request) {
Expand Down
69 changes: 0 additions & 69 deletions dgraph/cmd/alpha/login_ee.go

This file was deleted.

1 change: 1 addition & 0 deletions dgraph/cmd/alpha/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ func setupServer(closer *z.Closer) {
baseMux := http.NewServeMux()
http.Handle("/", audit.AuditRequestHttp(baseMux))

http.HandleFunc("/login", loginHandler)
baseMux.HandleFunc("/query", queryHandler)
baseMux.HandleFunc("/query/", queryHandler)
baseMux.HandleFunc("/mutate", mutationHandler)
Expand Down
6 changes: 5 additions & 1 deletion dgraph/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ import (
"github.com/hypermodeinc/dgraph/v24/dgraph/cmd/migrate"
"github.com/hypermodeinc/dgraph/v24/dgraph/cmd/version"
"github.com/hypermodeinc/dgraph/v24/dgraph/cmd/zero"
"github.com/hypermodeinc/dgraph/v24/ee/acl"
"github.com/hypermodeinc/dgraph/v24/ee/audit"
"github.com/hypermodeinc/dgraph/v24/ee/backup"
"github.com/hypermodeinc/dgraph/v24/upgrade"
"github.com/hypermodeinc/dgraph/v24/x"
)
Expand Down Expand Up @@ -74,7 +77,8 @@ var rootConf = viper.New()
var subcommands = []*x.SubCommand{
&bulk.Bulk, &cert.Cert, &conv.Conv, &live.Live, &alpha.Alpha, &zero.Zero, &version.Version,
&debug.Debug, &migrate.Migrate, &debuginfo.DebugInfo, &upgrade.Upgrade, &decrypt.Decrypt, &increment.Increment,
&checkupgrade.CheckUpgrade,
&checkupgrade.CheckUpgrade, &backup.Restore, &backup.LsBackup, &backup.ExportBackup, &acl.CmdAcl,
&audit.CmdAudit,
}

func initCmds() {
Expand Down
25 changes: 0 additions & 25 deletions dgraph/cmd/root_ee.go

This file was deleted.

Loading