Skip to content

Commit e90a6a1

Browse files
committed
Avoid bash references and bashisms as much as possible
1 parent 2a888b8 commit e90a6a1

File tree

10 files changed

+79
-78
lines changed

10 files changed

+79
-78
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ simplified code, development, and deployment.
1010

1111
Requires [Node.js 18 or above](https://nodejs.org/en/).
1212

13-
```bash
13+
```sh
1414
npm start
1515
```
1616

@@ -26,7 +26,7 @@ You can find pre-built releases at
2626
[Refacto/releases](https://github.com/davidje13/Refacto/releases),
2727
or you can build your own:
2828

29-
```bash
29+
```sh
3030
npm run build
3131
```
3232

@@ -37,7 +37,7 @@ The output is placed in `build`.
3737
You will need to have NodeJS 18 or newer installed in the deployment
3838
environment.
3939

40-
```bash
40+
```sh
4141
cd build
4242
npm install --omit=dev
4343
./index.js
@@ -66,7 +66,7 @@ values) can be found in
6666

6767
Typical values to configure are:
6868

69-
```bash
69+
```sh
7070
PORT=5000 \
7171
SSO_GOOGLE_CLIENT_ID="<your-google-client-id>" \
7272
SSO_GITHUB_CLIENT_ID="<your-github-client-id>" \

docs/CONTRIBUTING.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Running locally
44

5-
```bash
5+
```sh
66
npm start
77
```
88

@@ -19,33 +19,33 @@ Google sign in) and data persistence, see the
1919

2020
Run all tests:
2121

22-
```bash
22+
```sh
2323
npm test
2424
```
2525

2626
### Testing frontend only
2727

28-
```bash
28+
```sh
2929
npm run test:frontend
3030
```
3131

3232
Watch mode:
3333

34-
```bash
34+
```sh
3535
npm run test:frontend:watch
3636
```
3737

3838
### Testing backend only
3939

40-
```bash
40+
```sh
4141
npm run test:backend
4242
```
4343

4444
### End-to-end tests only
4545

4646
To automatically build and run the server, and run tests against it:
4747

48-
```bash
48+
```sh
4949
npm run test:e2e
5050
```
5151

@@ -56,7 +56,7 @@ uses a mock Google single-sign-on endpoint even if you have configured
5656
a real client ID), then run the end-to-end tests against that
5757
deployment:
5858

59-
```bash
59+
```sh
6060
TARGET_HOST=http://localhost:5000/ MODE=dev npm run test:e2e
6161
```
6262

@@ -65,7 +65,7 @@ larger when built in dev mode via `npm start`)
6565

6666
Run end-to-end tests with non-headless browsers:
6767

68-
```bash
68+
```sh
6969
HEADLESS=false npm run test:e2e
7070
```
7171

@@ -74,14 +74,14 @@ to `src/e2e/build/app.log`.
7474

7575
## Building
7676

77-
```bash
77+
```sh
7878
npm run build
7979
```
8080

8181
The output will be placed in `build`. Specify the `PORT` environment
8282
variable when running (defaults to 5000):
8383

84-
```bash
84+
```sh
8585
cd build
8686
npm install --omit=dev
8787
PORT=8080 ./index.js
@@ -116,19 +116,19 @@ and build / test dependencies should be installed with `--save-dev`.
116116

117117
### Examples
118118

119-
```bash
119+
```sh
120120
cd src/frontend
121121
npm install --save react
122122
npm install --save-dev jest
123123
```
124124

125-
```bash
125+
```sh
126126
cd src/backend
127127
npm install --save express
128128
npm install --save-dev supertest
129129
```
130130

131-
```bash
131+
```sh
132132
cd src/e2e
133133
npm install --save-dev selenium-webdriver
134134
```

docs/SECURITY.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Deploying to a platform-as-a-service will handle this automatically.
1010

1111
When deploying behind a proxy, you should set `TRUST_PROXY=true`:
1212

13-
```bash
13+
```sh
1414
TRUST_PROXY=true ./index.js
1515
```
1616

@@ -27,7 +27,7 @@ work factor, individual salts, and a "brute-force salt".
2727
If you have a powerful webserver, you can increase the hash work
2828
factor:
2929

30-
```bash
30+
```sh
3131
PASSWORD_WORK_FACTOR=12 ./index.js
3232
```
3333

@@ -54,7 +54,7 @@ constant with deployments of new versions of the app. The best place to
5454
store this value is in a deployment pipeline configuration, or a
5555
configuration server.
5656

57-
```bash
57+
```sh
5858
PASSWORD_SECRET_PEPPER="asecretwhichmustnotbeknown" ./index.js
5959
```
6060

@@ -100,14 +100,14 @@ regardless of database choice. By default, a secret key of all zeros
100100
is used, providing no real protection. To get the benefits of data
101101
encryption, supply a secret key on startup.
102102

103-
```bash
103+
```sh
104104
ENCRYPTION_SECRET_KEY="0000000000000000000000000000000000000000000000000000000000000000" ./index.js
105105
```
106106

107107
The secret key should be 32 random bytes (256 bits) encoded in
108108
base16 (hex). You can generate a random key with:
109109

110-
```bash
110+
```sh
111111
./scripts/random-secrets.js
112112
```
113113

@@ -138,7 +138,7 @@ deployments of new versions of the app. The best place to store this
138138
value is in a deployment pipeline configuration, or a configuration
139139
server.
140140

141-
```bash
141+
```sh
142142
TOKEN_SECRET_PASSPHRASE="asecretwhichmustnotbeknown" ./index.js
143143
```
144144

@@ -181,20 +181,20 @@ will be complete.
181181

182182
2. Enforce authorization:
183183

184-
```bash
184+
```sh
185185
echo 'security.authorization: enabled' >> /usr/local/etc/mongod.conf
186186
brew services restart mongodb
187187
```
188188

189189
You can now connect as the `admin` user:
190190

191-
```bash
191+
```sh
192192
mongo --authenticationDatabase admin -u admin -p
193193
```
194194

195195
And configure Refacto to connect as the `refacto` user:
196196

197-
```bash
197+
```sh
198198
DB_URL="mongodb://refacto:<pass>@localhost:27017/refacto" ./index.js
199199
```
200200

@@ -205,7 +205,7 @@ DB_URL="mongodb://refacto:<pass>@localhost:27017/refacto" ./index.js
205205
To enable SSL (encrypted) communications, but without server or client
206206
identity checks:
207207

208-
```bash
208+
```sh
209209
# macOS
210210
MONGO_VAR="/usr/local/var/mongodb"
211211
MONGO_CONF="/usr/local/etc/mongod.conf"
@@ -244,15 +244,15 @@ sudo service mongod restart
244244

245245
After enabling security, change the database URL when starting Refacto:
246246

247-
```bash
247+
```sh
248248
DB_URL="mongodb://localhost:27017/refacto?ssl=true" ./index.js
249249
```
250250

251251
Note that after enabling this, unless you also configure identity
252252
checks, you will need to skip certificate validation when connecting
253253
via the commandline:
254254

255-
```bash
255+
```sh
256256
mongo --ssl --sslAllowInvalidCertificates
257257
```
258258

docs/SERVICES.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,28 @@ load-balancing, configure a real database:
1111

1212
You can specify the database connection string as:
1313

14-
```bash
14+
```sh
1515
DB_URL="mongodb://localhost:27017/refacto" ./index.js
1616
```
1717

1818
The URL can also contain options, such as:
1919

20-
```bash
20+
```sh
2121
DB_URL="mongodb://localhost:27017/refacto?ssl=true" ./index.js
2222
```
2323

2424
#### Installation
2525

2626
On macOS, MongoDB can be installed with:
2727

28-
```bash
28+
```sh
2929
brew install mongodb
3030
brew services start mongodb
3131
```
3232

3333
On Ubuntu, it can be installed with:
3434

35-
```bash
35+
```sh
3636
apt install mongodb
3737
```
3838

@@ -48,7 +48,7 @@ the [security documentation](./SECURITY.md) for details.*
4848
Redis is also supported for persisting data, but is experimental and
4949
not recommended for production deployments.
5050

51-
```bash
51+
```sh
5252
DB_URL="redis://localhost:6379/0" ./index.js
5353
```
5454

@@ -61,7 +61,7 @@ securely configure PostgreSQL than MongoDB.
6161
You must create a database for Refacto to use. The schema will be
6262
auto-generated when the app starts.
6363

64-
```bash
64+
```sh
6565
DB_URL="postgresql://localhost:5432/refacto" ./index.js
6666
```
6767

@@ -89,7 +89,7 @@ You can now invoke the application with the `SSO_GOOGLE_CLIENT_ID`
8989
environment variable set. This applies to both local testing and
9090
deployments. For example:
9191

92-
```bash
92+
```sh
9393
SSO_GOOGLE_CLIENT_ID="something.apps.googleusercontent.com" ./index.js
9494
```
9595

@@ -108,7 +108,7 @@ You can now invoke the application with the `SSO_GITHUB_CLIENT_ID` and
108108
`SSO_GITHUB_CLIENT_SECRET` environment variables set. This applies to
109109
both local testing and deployments. For example:
110110

111-
```bash
111+
```sh
112112
SSO_GITHUB_CLIENT_ID="idhere" SSO_GITHUB_CLIENT_SECRET="secrethere" ./index.js
113113
```
114114

@@ -128,14 +128,14 @@ You can now invoke the application with the `SSO_GITLAB_CLIENT_ID`
128128
environment variable set. This applies to both local testing and
129129
deployments. For example:
130130

131-
```bash
131+
```sh
132132
SSO_GITLAB_CLIENT_ID="idhere" ./index.js
133133
```
134134

135135
To use a self-hosted GitLab deployment, you will also need to set
136136
the auth and token info URLs:
137137

138-
```bash
138+
```sh
139139
SSO_GITLAB_AUTH_URL="https://gitlab.example.com/oauth/authorize" \
140140
SSO_GITLAB_TOKEN_INFO_URL="https://gitlab.example.com/oauth/token/info" \
141141
SSO_GITLAB_CLIENT_ID="idhere" \
@@ -155,7 +155,7 @@ You will need a Giphy API key:
155155
You can now invoke the application with the `GIPHY_API_KEY` environment
156156
variable set. This applies to both local testing and deployments. For example:
157157

158-
```bash
158+
```sh
159159
GIPHY_API_KEY="keyhere" ./index.js
160160
```
161161

@@ -169,6 +169,6 @@ No configuration is required.
169169

170170
If you wish to _disable_ this integration, you can specify a blank URL:
171171

172-
```bash
172+
```sh
173173
PASSWORD_CHECK_BASE_URL="" ./index.js
174174
```

0 commit comments

Comments
 (0)