Skip to content

Commit 83aba63

Browse files
committed
Change remaining localhost to 127.0.0.1
1 parent a79d9d8 commit 83aba63

16 files changed

+30
-30
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ jobs:
223223
--health-retries 5
224224
env:
225225
PARSE_SERVER_TEST_DB: postgres
226-
PARSE_SERVER_TEST_DATABASE_URI: postgres://postgres:postgres@localhost:5432/parse_server_postgres_adapter_test_database
226+
PARSE_SERVER_TEST_DATABASE_URI: postgres://postgres:postgres@127.0.0.1:5432/parse_server_postgres_adapter_test_database
227227
NODE_VERSION: ${{ matrix.NODE_VERSION }}
228228
steps:
229229
- uses: actions/checkout@v2

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Once you have babel running in watch mode, you can start making changes to parse
129129

130130
If your pull request introduces a change that may affect the storage or retrieval of objects, you may want to make sure it plays nice with Postgres.
131131

132-
* Run the tests against the postgres database with `PARSE_SERVER_TEST_DB=postgres PARSE_SERVER_TEST_DATABASE_URI=postgres://postgres:password@localhost:5432/parse_server_postgres_adapter_test_database npm run testonly`. You'll need to have postgres running on your machine and setup [appropriately](https://github.com/parse-community/parse-server/blob/master/scripts/before_script_postgres.sh) or use [`Docker`](#run-a-parse-postgres-with-docker).
132+
* Run the tests against the postgres database with `PARSE_SERVER_TEST_DB=postgres PARSE_SERVER_TEST_DATABASE_URI=postgres://postgres:password@127.0.0.1:5432/parse_server_postgres_adapter_test_database npm run testonly`. You'll need to have postgres running on your machine and setup [appropriately](https://github.com/parse-community/parse-server/blob/master/scripts/before_script_postgres.sh) or use [`Docker`](#run-a-parse-postgres-with-docker).
133133
* The Postgres adapter has a special debugger that traces all the sql commands. You can enable it with setting the environment variable `PARSE_SERVER_LOG_LEVEL=debug`
134134
* If your feature is intended to only work with MongoDB, you should disable PostgreSQL-specific tests with:
135135

scripts/before_script_postgres.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44

55
echo "[SCRIPT] Before Script :: Setup Parse DB for Postgres"
66

7-
PGPASSWORD=postgres psql -v ON_ERROR_STOP=1 -h localhost -U postgres <<-EOSQL
7+
PGPASSWORD=postgres psql -v ON_ERROR_STOP=1 -h 127.0.0.1 -U postgres <<-EOSQL
88
CREATE DATABASE parse_server_postgres_adapter_test_database;
99
\c parse_server_postgres_adapter_test_database;
1010
CREATE EXTENSION pgcrypto;

scripts/before_script_postgres_conf.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ echo "[SCRIPT] Before Script :: Setup Parse Postgres configuration file"
1111
# CPUs num: 1
1212
# Data Storage: ssd
1313

14-
PGPASSWORD=postgres psql -v ON_ERROR_STOP=1 -h localhost -U postgres <<-EOSQL
14+
PGPASSWORD=postgres psql -v ON_ERROR_STOP=1 -h 127.0.0.1 -U postgres <<-EOSQL
1515
ALTER SYSTEM SET max_connections TO '200';
1616
ALTER SYSTEM SET shared_buffers TO '1536MB';
1717
ALTER SYSTEM SET effective_cache_size TO '4608MB';

spec/CloudCode.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,7 @@ describe('Cloud Code', () => {
16651665

16661666
request({
16671667
method: 'POST',
1668-
url: `http://${Parse.applicationId}:${Parse.masterKey}@localhost:8378/1/jobs/myJob`,
1668+
url: `http://${Parse.applicationId}:${Parse.masterKey}@127.0.0.1:8378/1/jobs/myJob`,
16691669
})
16701670
.then(async response => {
16711671
const jobStatusId = response.headers['x-parse-job-status-id'];

spec/LdapAuth.spec.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('Ldap Auth', () => {
2323
const server = await mockLdapServer(port, 'uid=testuser, o=example');
2424
const options = {
2525
suffix: 'o=example',
26-
url: `ldap://localhost:${port}`,
26+
url: `ldap://127.0.0.1:${port}`,
2727
dn: 'uid={{id}}, o=example',
2828
};
2929
await ldap.validateAuthData({ id: 'testuser', password: 'secret' }, options);
@@ -34,7 +34,7 @@ describe('Ldap Auth', () => {
3434
const server = await mockLdapServer(sslport, 'uid=testuser, o=example', false, true);
3535
const options = {
3636
suffix: 'o=example',
37-
url: `ldaps://localhost:${sslport}`,
37+
url: `ldaps://127.0.0.1:${sslport}`,
3838
dn: 'uid={{id}}, o=example',
3939
tlsOptions: { rejectUnauthorized: false },
4040
};
@@ -46,7 +46,7 @@ describe('Ldap Auth', () => {
4646
const server = await mockLdapServer(sslport, 'uid=testuser, o=example', false, true);
4747
const options = {
4848
suffix: 'o=example',
49-
url: `ldaps://localhost:${sslport}`,
49+
url: `ldaps://127.0.0.1:${sslport}`,
5050
dn: 'uid={{id}}, o=example',
5151
tlsOptions: {
5252
ca: fs.readFileSync(__dirname + '/support/cert/cert.pem'),
@@ -61,7 +61,7 @@ describe('Ldap Auth', () => {
6161
const server = await mockLdapServer(sslport, 'uid=testuser, o=example', false, true);
6262
const options = {
6363
suffix: 'o=example',
64-
url: `ldaps://localhost:${sslport}`,
64+
url: `ldaps://127.0.0.1:${sslport}`,
6565
dn: 'uid={{id}}, o=example',
6666
tlsOptions: {
6767
ca: fs.readFileSync(__dirname + '/support/cert/anothercert.pem'),
@@ -81,7 +81,7 @@ describe('Ldap Auth', () => {
8181
const server = await mockLdapServer(sslport, 'uid=testuser, o=example', false, true);
8282
const options = {
8383
suffix: 'o=example',
84-
url: `ldaps://localhost:${sslport}`,
84+
url: `ldaps://127.0.0.1:${sslport}`,
8585
dn: 'uid={{id}}, o=example',
8686
tlsOptions: {
8787
ca: fs.readFileSync(__dirname + '/support/cert/cert.pem'),
@@ -101,7 +101,7 @@ describe('Ldap Auth', () => {
101101
const server = await mockLdapServer(port, 'uid=testuser, o=example');
102102
const options = {
103103
suffix: 'o=example',
104-
url: `ldap://localhost:${port}`,
104+
url: `ldap://127.0.0.1:${port}`,
105105
dn: 'uid={{id}}, o=example',
106106
};
107107
try {
@@ -117,7 +117,7 @@ describe('Ldap Auth', () => {
117117
const server = await mockLdapServer(port, 'uid=testuser, o=example');
118118
const options = {
119119
suffix: 'o=example',
120-
url: `ldap://localhost:${port}`,
120+
url: `ldap://127.0.0.1:${port}`,
121121
dn: 'uid={{id}}, o=example',
122122
groupCn: 'powerusers',
123123
groupFilter: '(&(uniqueMember=uid={{id}}, o=example)(objectClass=groupOfUniqueNames))',
@@ -130,7 +130,7 @@ describe('Ldap Auth', () => {
130130
const server = await mockLdapServer(port, 'uid=testuser, o=example');
131131
const options = {
132132
suffix: 'o=example',
133-
url: `ldap://localhost:${port}`,
133+
url: `ldap://127.0.0.1:${port}`,
134134
dn: 'uid={{id}}, o=example',
135135
groupCn: 'groupTheUserIsNotIn',
136136
groupFilter: '(&(uniqueMember=uid={{id}}, o=example)(objectClass=groupOfUniqueNames))',
@@ -148,7 +148,7 @@ describe('Ldap Auth', () => {
148148
const server = await mockLdapServer(port, 'uid=testuser, o=example');
149149
const options = {
150150
suffix: 'o=invalid',
151-
url: `ldap://localhost:${port}`,
151+
url: `ldap://127.0.0.1:${port}`,
152152
dn: 'uid={{id}}, o=example',
153153
groupCn: 'powerusers',
154154
groupFilter: '(&(uniqueMember=uid={{id}}, o=example)(objectClass=groupOfUniqueNames))',
@@ -166,7 +166,7 @@ describe('Ldap Auth', () => {
166166
const server = await mockLdapServer(port, 'uid=testuser, o=example', true);
167167
const options = {
168168
suffix: 'o=example',
169-
url: `ldap://localhost:${port}`,
169+
url: `ldap://127.0.0.1:${port}`,
170170
dn: 'uid={{id}}, o=example',
171171
groupCn: 'powerusers',
172172
groupFilter: '(&(uniqueMember=uid={{id}}, o=example)(objectClass=groupOfUniqueNames))',
@@ -184,7 +184,7 @@ describe('Ldap Auth', () => {
184184
const server = await mockLdapServer(port, 'uid=testuser, o=example', true);
185185
const options = {
186186
suffix: 'o=example',
187-
url: `ldap://localhost:${port}`,
187+
url: `ldap://127.0.0.1:${port}`,
188188
dn: 'uid={{id}}, o=example',
189189
};
190190
const authData = { id: 'testuser', password: 'secret' };
@@ -197,7 +197,7 @@ describe('Ldap Auth', () => {
197197
const server = await mockLdapServer(port, 'uid=testuser, o=example', true);
198198
const options = {
199199
suffix: 'o=example',
200-
url: `ldap://localhost:${port}`,
200+
url: `ldap://127.0.0.1:${port}`,
201201
dn: 'uid={{id}}, o=example',
202202
};
203203
await reconfigureServer({ auth: { ldap: options } });

spec/MongoStorageAdapter.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
2424
it('auto-escapes symbols in auth information', () => {
2525
spyOn(MongoClient, 'connect').and.returnValue(Promise.resolve(fakeClient));
2626
new MongoStorageAdapter({
27-
uri: 'mongodb://user!with@+ symbols:password!with@+ symbols@localhost:1234/parse',
27+
uri: 'mongodb://user!with@+ symbols:password!with@+ symbols@127.0.0.1:1234/parse',
2828
}).connect();
2929
expect(MongoClient.connect).toHaveBeenCalledWith(
30-
'mongodb://user!with%40%2B%20symbols:password!with%40%2B%20symbols@localhost:1234/parse',
30+
'mongodb://user!with%40%2B%20symbols:password!with%40%2B%20symbols@127.0.0.1:1234/parse',
3131
jasmine.any(Object)
3232
);
3333
});
3434

3535
it("doesn't double escape already URI-encoded information", () => {
3636
spyOn(MongoClient, 'connect').and.returnValue(Promise.resolve(fakeClient));
3737
new MongoStorageAdapter({
38-
uri: 'mongodb://user!with%40%2B%20symbols:password!with%40%2B%20symbols@localhost:1234/parse',
38+
uri: 'mongodb://user!with%40%2B%20symbols:password!with%40%2B%20symbols@127.0.0.1:1234/parse',
3939
}).connect();
4040
expect(MongoClient.connect).toHaveBeenCalledWith(
41-
'mongodb://user!with%40%2B%20symbols:password!with%40%2B%20symbols@localhost:1234/parse',
41+
'mongodb://user!with%40%2B%20symbols:password!with%40%2B%20symbols@127.0.0.1:1234/parse',
4242
jasmine.any(Object)
4343
);
4444
});

spec/OAuth1.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ describe('OAuth', function () {
128128

129129
it('Should fail a request', done => {
130130
const options = {
131-
host: 'localhost',
131+
host: '127.0.0.1',
132132
consumer_key: 'XXXXXXXXXXXXXXXXXXXXXXXXX',
133133
consumer_secret: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
134134
};

spec/ParseGraphQLServer.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ describe('ParseGraphQLServer', () => {
411411
await new Promise(resolve => httpServer.listen({ port: 13377 }, resolve));
412412

413413
const subscriptionClient = new SubscriptionClient(
414-
'ws://localhost:13377/subscriptions',
414+
'ws://127.0.0.1:13377/subscriptions',
415415
{
416416
reconnect: true,
417417
connectionParams: headers,

spec/ParseServer.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe('Server Url Checks', () => {
5454

5555
xit('handleShutdown, close connection', done => {
5656
const mongoURI = 'mongodb://127.0.0.1:27017/parseServerMongoAdapterTestDatabase';
57-
const postgresURI = 'postgres://localhost:5432/parse_server_postgres_adapter_test_database';
57+
const postgresURI = 'postgres://127.0.0.1:5432/parse_server_postgres_adapter_test_database';
5858
let databaseAdapter;
5959
if (process.env.PARSE_SERVER_TEST_DB === 'postgres') {
6060
databaseAdapter = new PostgresStorageAdapter({

spec/PostgresConfigParser.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('PostgresConfigParser.parseQueryParams', () => {
2323
});
2424
});
2525

26-
const baseURI = 'postgres://username:password@localhost:5432/db-name';
26+
const baseURI = 'postgres://username:password@127.0.0.1:5432/db-name';
2727
const testfile = fs.readFileSync('./Dockerfile').toString();
2828
const dbOptionsTest = {};
2929
dbOptionsTest[

spec/PostgresInitOptions.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const PostgresStorageAdapter = require('../lib/Adapters/Storage/Postgres/Postgre
33
.default;
44
const postgresURI =
55
process.env.PARSE_SERVER_TEST_DATABASE_URI ||
6-
'postgres://localhost:5432/parse_server_postgres_adapter_test_database';
6+
'postgres://127.0.0.1:5432/parse_server_postgres_adapter_test_database';
77
const ParseServer = require('../lib/index');
88
const express = require('express');
99
//public schema

spec/PostgresStorageAdapter.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const PostgresStorageAdapter = require('../lib/Adapters/Storage/Postgres/Postgre
22
.default;
33
const databaseURI =
44
process.env.PARSE_SERVER_TEST_DATABASE_URI ||
5-
'postgres://localhost:5432/parse_server_postgres_adapter_test_database';
5+
'postgres://127.0.0.1:5432/parse_server_postgres_adapter_test_database';
66
const Config = require('../lib/Config');
77

88
const getColumns = (client, className) => {

spec/helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const RESTController = require('parse/lib/node/RESTController');
4242
const { VolatileClassesSchemas } = require('../lib/Controllers/SchemaController');
4343

4444
const mongoURI = 'mongodb://127.0.0.1:27017/parseServerMongoAdapterTestDatabase';
45-
const postgresURI = 'postgres://localhost:5432/parse_server_postgres_adapter_test_database';
45+
const postgresURI = 'postgres://127.0.0.1:5432/parse_server_postgres_adapter_test_database';
4646
let databaseAdapter;
4747
// need to bind for mocking mocha
4848

spec/index.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('server', () => {
6464
it('fails if database is unreachable', done => {
6565
reconfigureServer({
6666
databaseAdapter: new MongoStorageAdapter({
67-
uri: 'mongodb://fake:fake@localhost:43605/drew3',
67+
uri: 'mongodb://fake:fake@127.0.0.1:43605/drew3',
6868
mongoOptions: {
6969
serverSelectionTimeoutMS: 2000,
7070
},

src/Adapters/Storage/Postgres/PostgresConfigParser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function getDatabaseOptionsFromURI(uri) {
77
const queryParams = parseQueryParams(parsedURI.query);
88
const authParts = parsedURI.auth ? parsedURI.auth.split(':') : [];
99

10-
databaseOptions.host = parsedURI.hostname || 'localhost';
10+
databaseOptions.host = parsedURI.hostname || '127.0.0.1';
1111
databaseOptions.port = parsedURI.port ? parseInt(parsedURI.port) : 5432;
1212
databaseOptions.database = parsedURI.pathname ? parsedURI.pathname.substr(1) : undefined;
1313

0 commit comments

Comments
 (0)