Skip to content

Commit 4ceb2f7

Browse files
lidiazuinrecrwplaymjfwebbdarrellwarde
authored
Standardise auth variables #93 (#95)
* Add page-aliases for version 4 (#31) (#32) Co-authored-by: Neil Dewhurst <[email protected]> * Editorial review of the latest additions (#34) * Update publish.yml * Editorial review of the most recent changes * reverting changes to partials * fixing note formatting * Add page-aliases for version 4 (#31) (#32) Co-authored-by: Neil Dewhurst <[email protected]> * Editorial review of the most recent changes * fixing note formatting * Add page-aliases for version 4 (#31) (#32) Co-authored-by: Neil Dewhurst <[email protected]> * Editorial review of the most recent changes * fixing note formatting * Add page-aliases for version 4 (#31) (#32) Co-authored-by: Neil Dewhurst <[email protected]> * Editorial review of the most recent changes * Add page-aliases for version 4 (#31) * revert * Apply suggestions from code review Co-authored-by: Michael Webb <[email protected]> --------- Co-authored-by: Neil Dewhurst <[email protected]> Co-authored-by: Michael Webb <[email protected]> * Fix scalar description placeholders #38 (#39) * Editorial review of the most recent changes * reverting changes to partials * fixing note formatting * Add page-aliases for version 4 (#31) (#32) Co-authored-by: Neil Dewhurst <[email protected]> * Editorial review of the most recent changes * fixing note formatting * Editorial review of the most recent changes * fixing note formatting * Add page-aliases for version 4 (#31) (#32) Co-authored-by: Neil Dewhurst <[email protected]> * Editorial review of the most recent changes * Fix scalar description placeholders (#38) --------- Co-authored-by: Neil Dewhurst <[email protected]> Co-authored-by: Darrell Warde <[email protected]> * Editorial review of the most recent changes * reverting changes to partials * Add page-aliases for version 4 (#31) (#32) Co-authored-by: Neil Dewhurst <[email protected]> * Editorial review of the most recent changes * Editorial review of the most recent changes * fixing note formatting * Add page-aliases for version 4 (#31) (#32) Co-authored-by: Neil Dewhurst <[email protected]> * Editorial review of the most recent changes * Standardise auth variables (#93) * docs: use "username" in where username would be used in code examples * docs: fix typos * docs: remove part about creating a .env file --------- Co-authored-by: Neil Dewhurst <[email protected]> Co-authored-by: Michael Webb <[email protected]> Co-authored-by: Darrell Warde <[email protected]>
1 parent 4e15b52 commit 4ceb2f7

File tree

21 files changed

+70
-96
lines changed

21 files changed

+70
-96
lines changed

modules/ROOT/pages/authentication-and-authorization/impersonation-and-user-switching.adoc

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ const typeDefs = `#graphql
3232
3333
const driver = neo4j.driver(
3434
"neo4j://localhost:7687",
35-
neo4j.auth.basic("neo4j", "password")
35+
neo4j.auth.basic("username", "password")
3636
);
3737
38-
const neo4jgraphql = new Neo4jGraphQL({
38+
const neo4jGraphql = new Neo4jGraphQL({
3939
typeDefs,
4040
driver,
4141
});
4242
43-
const schema = await neo4jgraphql.getSchema();
43+
const schema = await neo4jGraphql.getSchema();
4444
4545
const server = new ApolloServer<Neo4jGraphQLContext>({
4646
schema,
@@ -76,15 +76,15 @@ const typeDefs = `#graphql
7676
7777
const driver = neo4j.driver(
7878
"neo4j://localhost:7687",
79-
neo4j.auth.basic("neo4j", "password")
79+
neo4j.auth.basic("username", "password")
8080
);
8181
82-
const neo4jgraphql = new Neo4jGraphQL({
82+
const neo4jGraphql = new Neo4jGraphQL({
8383
typeDefs,
8484
driver,
8585
});
8686
87-
const schema = await neo4jgraphql.getSchema();
87+
const schema = await neo4jGraphql.getSchema();
8888
8989
const server = new ApolloServer({
9090
schema,
@@ -130,15 +130,15 @@ const typeDefs = `#graphql
130130
131131
const driver = neo4j.driver(
132132
"neo4j://localhost:7687",
133-
neo4j.auth.basic("neo4j", "password")
133+
neo4j.auth.basic("username", "password")
134134
);
135135
136-
const neo4jgraphql = new Neo4jGraphQL({
136+
const neo4jGraphql = new Neo4jGraphQL({
137137
typeDefs,
138138
driver,
139139
});
140140
141-
const schema = await neo4jgraphql.getSchema();
141+
const schema = await neo4jGraphql.getSchema();
142142
143143
const server = new ApolloServer<Neo4jGraphQLContext>({
144144
schema,
@@ -174,15 +174,15 @@ const typeDefs = `#graphql
174174
175175
const driver = neo4j.driver(
176176
"neo4j://localhost:7687",
177-
neo4j.auth.basic("neo4j", "password")
177+
neo4j.auth.basic("username", "password")
178178
);
179179
180-
const neo4jgraphql = new Neo4jGraphQL({
180+
const neo4jGraphql = new Neo4jGraphQL({
181181
typeDefs,
182182
driver,
183183
});
184184
185-
const schema = await neo4jgraphql.getSchema();
185+
const schema = await neo4jGraphql.getSchema();
186186
187187
const server = new ApolloServer({
188188
schema,
@@ -201,5 +201,3 @@ console.log(`🚀 Server ready at: ${url}`);
201201
----
202202
=====
203203
====
204-
205-

modules/ROOT/pages/driver-configuration.adoc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const typeDefs = `#graphql
2929
3030
const driver = neo4j.driver(
3131
"bolt://localhost:7687",
32-
neo4j.auth.basic("neo4j", "password")
32+
neo4j.auth.basic("username", "password")
3333
);
3434
3535
const neoSchema = new Neo4jGraphQL({ typeDefs, driver });
@@ -61,7 +61,7 @@ const typeDefs = `#graphql
6161
6262
const driver = neo4j.driver(
6363
"bolt://localhost:7687",
64-
neo4j.auth.basic("neo4j", "password")
64+
neo4j.auth.basic("username", "password")
6565
);
6666
6767
const neoSchema = new Neo4jGraphQL({ typeDefs, driver });
@@ -93,7 +93,7 @@ const typeDefs = `#graphql
9393
9494
const driver = neo4j.driver(
9595
"bolt://localhost:7687",
96-
neo4j.auth.basic("neo4j", "password")
96+
neo4j.auth.basic("username", "password")
9797
);
9898
const session = driver.session();
9999
@@ -126,7 +126,7 @@ const typeDefs = `#graphql
126126
127127
const driver = neo4j.driver(
128128
"bolt://localhost:7687",
129-
neo4j.auth.basic("neo4j", "password")
129+
neo4j.auth.basic("username", "password")
130130
);
131131
const session = driver.transaction();
132132
const transaction = session.beginTransaction();
@@ -158,7 +158,7 @@ const typeDefs = `#graphql
158158
159159
const driver = neo4j.driver(
160160
"bolt://localhost:7687",
161-
neo4j.auth.basic("neo4j", "password")
161+
neo4j.auth.basic("username", "password")
162162
);
163163
164164
const ogm = new OGM({ typeDefs, driver });
@@ -185,7 +185,7 @@ const typeDefs = `#graphql
185185
186186
const driver = neo4j.driver(
187187
"bolt://localhost:7687",
188-
neo4j.auth.basic("neo4j", "password")
188+
neo4j.auth.basic("username", "password")
189189
);
190190
191191
const neoSchema = new Neo4jGraphQL({ typeDefs, driver });
@@ -207,7 +207,7 @@ const typeDefs = `#graphql
207207
208208
const driver = neo4j.driver(
209209
"bolt://localhost:7687",
210-
neo4j.auth.basic("neo4j", "password")
210+
neo4j.auth.basic("username", "password")
211211
);
212212
213213
const ogm = new OGM({ typeDefs, driver });
@@ -235,7 +235,7 @@ const typeDefs = `#graphql
235235
236236
const driver = neo4j.driver(
237237
"bolt://localhost:7687",
238-
neo4j.auth.basic("neo4j", "password")
238+
neo4j.auth.basic("username", "password")
239239
);
240240
241241
const neoSchema = new Neo4jGraphQL({ typeDefs, driver });

modules/ROOT/pages/getting-started/index.adoc

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,6 @@ To create an instance of the Neo4j GraphQL Library, you need a Neo4j driver to c
107107
+
108108
image::neo4j-aura-dashboard.png[width=500]
109109

110-
. Create a new file `.env` with the credentials described in the previous step.
111-
It should look like this:
112-
+
113-
[source, config]
114-
----
115-
NEO4J_USER=neo4j
116-
NEO4J_PASSWORD=password
117-
NEO4J_URI=neo4j+s://0083654f.databases.neo4j.io
118-
----
119-
120110
=== Using a Neo4j database
121111

122112
For a database located at the default "bolt://localhost:7687" (see more about https://neo4j.com/docs/operations-manual/current/configuration/ports[port configuration]), with the username "neo4j" and the password "password", add the following to the bottom of your `index.js` file:
@@ -125,7 +115,7 @@ For a database located at the default "bolt://localhost:7687" (see more about ht
125115
----
126116
const driver = neo4j.driver(
127117
"bolt://localhost:7687",
128-
neo4j.auth.basic("neo4j", "password")
118+
neo4j.auth.basic("username", "password")
129119
);
130120
131121
const neoSchema = new Neo4jGraphQL({ typeDefs, driver });
@@ -191,7 +181,7 @@ const typeDefs = `#graphql
191181
192182
const driver = neo4j.driver(
193183
"bolt://localhost:7687",
194-
neo4j.auth.basic("neo4j", "password")
184+
neo4j.auth.basic("username", "password")
195185
);
196186
197187
const neoSchema = new Neo4jGraphQL({ typeDefs, driver });
@@ -302,4 +292,4 @@ This concludes the tutorial.
302292
By now, you should have a GraphQL API connected to a Neo4j database, to which you added two nodes.
303293

304294
To learn more, keep reading the documentation about xref:queries-aggregations/index.adoc[Queries and aggregations] or alternatively learn how to use the xref:getting-started/toolbox.adoc[Neo4j GraphQL Toolbox].
305-
For more advanced database settings, refer to the xref:driver-configuration.adoc[Driver configuration] page.
295+
For more advanced database settings, refer to the xref:driver-configuration.adoc[Driver configuration] page.

modules/ROOT/pages/integrations/apollo-federation.adoc

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,9 @@ const typeDefs = `#graphql
2121
}
2222
`;
2323
24-
const {
25-
NEO4J_URI = "neo4j://localhost:7687/neo4j",
26-
NEO4J_USERNAME = "neo4j",
27-
NEO4J_PASSWORD = "password",
28-
} = process.env;
24+
const driver = neo4j.driver(NEO4J_URI, neo4j.auth.basic("username", "password"));
2925
30-
const driver = neo4j.driver(NEO4J_URI, neo4j.auth.basic(NEO4J_USERNAME, NEO4J_PASSWORD));
31-
32-
const neo4jgraphql = new Neo4jGraphQL({
26+
const neo4jGraphQL = new Neo4jGraphQL({
3327
typeDefs,
3428
driver,
3529
})
@@ -46,7 +40,7 @@ console.log(`🚀 Server ready at ${url}`);
4640

4741
== Setup
4842

49-
To proceed with the convertion, follow these steps:
43+
To proceed with the conversion, follow these steps:
5044

5145
. Create a directory for a new project and `cd` into it:
5246
+
@@ -224,7 +218,7 @@ For that, the following line needs to be changed:
224218

225219
[source, javascript]
226220
----
227-
const schema = neo4jgraphql.getSubgraphSchema();
221+
const schema = neo4jGraphql.getSubgraphSchema();
228222
----
229223

230224
== Conclusion
@@ -244,15 +238,9 @@ const typeDefs = `#graphql
244238
}
245239
`;
246240
247-
const {
248-
NEO4J_URI = "neo4j://localhost:7687/neo4j",
249-
NEO4J_USERNAME = "neo4j",
250-
NEO4J_PASSWORD = "password",
251-
} = process.env;
252-
253-
const driver = neo4j.driver(NEO4J_URI, neo4j.auth.basic(NEO4J_USERNAME, NEO4J_PASSWORD));
241+
const driver = neo4j.driver("bolt://localhost:7687", neo4j.auth.basic("username", "password"));
254242
255-
const neo4jgraphql = new Neo4jGraphQL({
243+
const neo4jGraphQL = new Neo4jGraphQL({
256244
typeDefs,
257245
driver,
258246
})
@@ -271,4 +259,4 @@ For further iteration, this subgraph can also be composed into a supergraph.
271259
Check Apollo's guides for more instructions:
272260

273261
* https://www.apollographql.com/docs/federation/quickstart/studio-composition[Composition in Apollo Studio]
274-
* https://www.apollographql.com/docs/federation/quickstart/local-composition[Local composition]
262+
* https://www.apollographql.com/docs/federation/quickstart/local-composition[Local composition]

modules/ROOT/pages/integrations/relay-compatibility.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ However, configuration is required for it to provide a mechanism for refetching
1212

1313
== Object identification
1414

15-
In order for a Relay client to be able to refetch objects, each type must have a unique object indentifier which can be used for this purpose.
15+
In order for a Relay client to be able to refetch objects, each type must have a unique object identifier which can be used for this purpose.
1616
A server then informs a Relay client that this requirement has been satisfied by having types that implement the `Node` directive, which has the following definition:
1717

1818
[source, graphql]

modules/ROOT/pages/introspector.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import neo4j from "neo4j-driver";
4040
4141
const driver = neo4j.driver(
4242
"neo4j://localhost:7687",
43-
neo4j.auth.basic("neo4j", "password")
43+
neo4j.auth.basic("username", "password")
4444
);
4545
4646
const sessionFactory = () => driver.session({ defaultAccessMode: neo4j.session.READ })
@@ -70,7 +70,7 @@ import neo4j from "neo4j-driver";
7070
7171
const driver = neo4j.driver(
7272
"neo4j://localhost:7687",
73-
neo4j.auth.basic("neo4j", "password")
73+
neo4j.auth.basic("username", "password")
7474
);
7575
7676
const sessionFactory = () =>

modules/ROOT/pages/migration/index.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const typeDefs = `
4545
4646
const driver = neo4j.driver(
4747
"bolt://localhost:7687",
48-
neo4j.auth.basic("neo4j", "password")
48+
neo4j.auth.basic("username", "password")
4949
);
5050
5151
const neoSchema = new Neo4jGraphQL({
@@ -71,7 +71,7 @@ const typeDefs = `
7171
7272
const driver = neo4j.driver(
7373
"bolt://localhost:7687",
74-
neo4j.auth.basic("neo4j", "password")
74+
neo4j.auth.basic("username", "password")
7575
);
7676
7777
const neoSchema = new Neo4jGraphQL({
@@ -107,7 +107,7 @@ const typeDefs = `#graphql
107107
108108
const driver = neo4j.driver(
109109
"bolt://localhost:7687",
110-
neo4j.auth.basic("neo4j", "password")
110+
neo4j.auth.basic("username", "password")
111111
);
112112
113113
const neoSchema = new Neo4jGraphQL({
@@ -144,7 +144,7 @@ const typeDefs = `#graphql
144144
145145
const driver = neo4j.driver(
146146
"bolt://localhost:7687",
147-
neo4j.auth.basic("neo4j", "password")
147+
neo4j.auth.basic("username", "password")
148148
);
149149
150150
const neoSchema = new Neo4jGraphQL({ typeDefs, driver });
@@ -176,7 +176,7 @@ neoSchema = new Neo4jGraphQL({
176176
typeDefs,
177177
config: {
178178
enableRegex: true
179-
}
179+
}
180180
});
181181
----
182182
a|
@@ -839,7 +839,7 @@ Note that defining `labels` means taking control of the database labels of the n
839839
Indexes and constraints in Neo4j only support a single label, for which the first element of the `labels` argument will be used. +
840840
{nbsp} +
841841
As before, providing none of these arguments results in the node label being the same as the GraphQL type name.
842-
This can cause implications on constraits.
842+
This can cause implications on constraints.
843843
For instance, in the case where unique constraint is asserted for the label `Tech` and the property `name`: +
844844
{nbsp} +
845845
[source, graphql, indent=0]

modules/ROOT/pages/migration/ogm.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const typeDefs = `#graphql
2222
2323
const driver = neo4j.driver(
2424
"bolt://localhost:7687",
25-
neo4j.auth.basic("neo4j", "password")
25+
neo4j.auth.basic("username", "password")
2626
);
2727
2828
const ogm = new OGM({ typeDefs, driver, driverConfig: { database: "some-other-database" } });
@@ -43,8 +43,8 @@ const typeDefs = `#graphql
4343
4444
const driver = neo4j.driver(
4545
"bolt://localhost:7687",
46-
neo4j.auth.basic("neo4j", "password")
46+
neo4j.auth.basic("username", "password")
4747
);
4848
4949
const ogm = new OGM({ typeDefs, driver, database: "some-other-database" });
50-
----
50+
----

modules/ROOT/pages/ogm/directives.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import neo4j from "neo4j-driver";
4545
4646
const driver = neo4j.driver(
4747
"bolt://localhost:7687",
48-
neo4j.auth.basic("admin", "password")
48+
neo4j.auth.basic("username", "password")
4949
);
5050
5151
const typeDefs = `

modules/ROOT/pages/ogm/installation.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import { createJWT, comparePassword } from "./utils"; // example util function,
6161
6262
const driver = neo4j.driver(
6363
"bolt://localhost:7687",
64-
neo4j.auth.basic("neo4j", "password")
64+
neo4j.auth.basic("username", "password")
6565
);
6666
6767
const typeDefs = `#graphql
@@ -237,7 +237,7 @@ const neo4j = require("neo4j-driver");
237237
238238
const driver = neo4j.driver(
239239
"bolt://localhost:7687",
240-
neo4j.auth.basic("neo4j", "password")
240+
neo4j.auth.basic("username", "password")
241241
);
242242
243243
const typeDefs = `

0 commit comments

Comments
 (0)