MCPcopy Create free account
hub / github.com/nhost/nhost / auth

Function auth

cli/dockercompose/auth.go:30–123  ·  view source on GitHub ↗
( //nolint:funlen
	cfg *model.ConfigConfig,
	subdomain string,
	httpPort uint,
	useTLS bool,
	nhostFolder string,
	exposePort uint,
)

Source from the content-addressed store, hash-verified

28}
29
30func auth( //nolint:funlen
31 cfg *model.ConfigConfig,
32 subdomain string,
33 httpPort uint,
34 useTLS bool,
35 nhostFolder string,
36 exposePort uint,
37) (*Service, error) {
38 if exposePort != 0 {
39 httpPort = exposePort
40 }
41
42 envars, err := appconfig.HasuraAuthEnv(
43 cfg,
44 "http://graphql:8080/v1/graphql",
45 URL(subdomain, "auth", httpPort, useTLS && exposePort == 0)+"/v1",
46 "postgres://nhost_hasura@postgres:5432/local",
47 "postgres://nhost_auth_admin@postgres:5432/local",
48 &model.ConfigSmtp{
49 User: new("user"),
50 Password: new("password"),
51 Sender: new("auth@example.com"),
52 Host: new("mailhog"),
53 Port: new(uint16(1025)), //nolint:mnd
54 Secure: new(false),
55 Method: new("LOGIN"),
56 },
57 false,
58 false,
59 "00000000-0000-0000-0000-000000000000",
60 "5181f67e2844e4b60d571fa346cac9c37fc00d1ff519212eae6cead138e639ba",
61 )
62 if err != nil {
63 return nil, fmt.Errorf("failed to get hasura env vars: %w", err)
64 }
65
66 env := make(map[string]string, len(envars))
67 for _, v := range envars {
68 env[v.Name] = v.Value
69 }
70
71 svc := &Service{
72 Image: "nhost/auth:" + *cfg.Auth.Version,
73 DependsOn: map[string]DependsOn{
74 "graphql": {
75 Condition: "service_healthy",
76 },
77 "postgres": {
78 Condition: "service_healthy",
79 },
80 },
81 EntryPoint: nil,
82 Command: nil,
83 Environment: env,
84 ExtraHosts: extraHosts(subdomain),
85 HealthCheck: &HealthCheck{
86 Test: []string{"CMD", "wget", "--spider", "-S", "http://localhost:4000/healthz"},
87 Timeout: "60s",

Callers 3

getServicesFunction · 0.85
TestAuthFunction · 0.85
TestNewAuthFuncFunction · 0.85

Calls 8

URLFunction · 0.85
extraHostsFunction · 0.85
traefikHostMatchFunction · 0.85
networkAliasesFunction · 0.85
portsFunction · 0.85
authPatchPre022Function · 0.85
ErrorfMethod · 0.80
LabelsMethod · 0.45

Tested by 2

TestAuthFunction · 0.68
TestNewAuthFuncFunction · 0.68