-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Make git-proxy executable, custom config file arg & validation, bump to 1.1.0 #287
Conversation
New executable ( $ docker run -it -v $(pwd):/src node:18-slim bash
root@577185b94f6b:/$ cd /src
root@577185b94f6b:/src$ npm link
added 1 package, and audited 3 packages in 1s
found 0 vulnerabilities
root@577185b94f6b:/src$ cd ~
root@577185b94f6b:~$ which git-proxy
/usr/local/bin/git-proxy
root@577185b94f6b:~$ ls -l /usr/local/bin/
total 89996
lrwxrwxrwx 1 root root 45 Aug 8 22:27 corepack -> ../lib/node_modules/corepack/dist/corepack.js
-rwxrwxr-x 1 root root 388 Aug 16 02:01 docker-entrypoint.sh
lrwxrwxrwx 1 root root 45 Sep 16 23:05 git-proxy -> ../lib/node_modules/@finos/git-proxy/index.js
-rwxr-xr-x 1 root root 92150296 Aug 8 22:27 node
lrwxrwxrwx 1 root root 19 Aug 16 02:02 nodejs -> /usr/local/bin/node
lrwxrwxrwx 1 root root 38 Aug 8 22:27 npm -> ../lib/node_modules/npm/bin/npm-cli.js
lrwxrwxrwx 1 root root 38 Aug 8 22:27 npx -> ../lib/node_modules/npm/bin/npx-cli.js
lrwxrwxrwx 1 root root 27 Aug 16 02:02 yarn -> /opt/yarn-v1.22.19/bin/yarn
lrwxrwxrwx 1 root root 30 Aug 16 02:02 yarnpkg -> /opt/yarn-v1.22.19/bin/yarnpkg
root@577185b94f6b:~$ git-proxy
Listening on 8000
creating user
user=admin,
gitAccount=none
email=admin@place.com,
admin=true
Service Listening on 8080
^C Create a proxy.config.json file in the local directory. It will now be read by git-proxy on startup and merged with the default settings. root@577185b94f6b:~# cat << EOF > proxy.config.json
> { "authentication": [ { "type": "foo", "enabled": true } ] }
> EOF
# this is an intentionally dummy config
root@577185b94f6b:~$ git-proxy
/src/src/service/passport/index.js:18
throw Error(`uknown authentication type ${type}`);
^
Error: uknown authentication type foo
at Object.configure (/src/src/service/passport/index.js:18:13)
at Object.start (/src/src/service/index.js:20:48)
at Object.<anonymous> (/src/index.js:6:9)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
Node.js v18.17.1 |
Added a lightweight "CLI" with On a fresh Docker container, I'm getting some odd behaviour at startup when using a custom file. It seems to clear after a restart but want to fix this. $ cat mygitproxysettings.json
{ "authorisedList": [ { "project": "foo", "name": "bar", "url": "https://github.com/foo/bar.git" } ] }
$ git-proxy --config ./mygitproxysettings.json
Listening on 8000
creating user
user=admin,
gitAccount=none
email=admin@place.com,
admin=true
Service Listening on 8080
/src/src/db/file/repo.js:58
if (repo.users.canPush.includes(user)) {
^
TypeError: Cannot read properties of null (reading 'users')
at /src/src/db/file/repo.js:58:14
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v18.17.1 |
dac8d81
to
eef3f88
Compare
README.md
Outdated
``` | ||
|
||
To install a specific version of Git Proxy, append the version to the end of the `install` command: | ||
|
||
```bash | ||
$ npm install @finos/git-proxy@1.0.0 | ||
$ npm install -g @finos/git-proxy@1.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coopernetes - makes sense to update this to 1.0.1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maoo @coopernetes - 1.1.0
is probably better as these changes constitute a minor improvement, rather than a patch.
README.md
Outdated
``` | ||
|
||
To install a specific version of Git Proxy, append the version to the end of the `install` command: | ||
|
||
```bash | ||
$ npm install @finos/git-proxy@1.0.0 | ||
$ npm install -g @finos/git-proxy@1.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here with -g
?
@coopernetes - are you able to take a look at the merge conflicts? Will be from the latest merge of #269. Thank you 🤝 |
README.md
Outdated
``` | ||
|
||
To install a specific version of Git Proxy, append the version to the end of the `install` command: | ||
|
||
```bash | ||
$ npm install @finos/git-proxy@1.0.0 | ||
$ npm install -g @finos/git-proxy@1.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ npm install -g @finos/git-proxy@1.0.0 | |
$ npm install -g @finos/git-proxy@1.1.0 |
README.md
Outdated
``` | ||
|
||
To install a specific version of Git Proxy, append the version to the end of the `install` command: | ||
|
||
```bash | ||
$ npm install @finos/git-proxy@1.0.0 | ||
$ npm install -g @finos/git-proxy@1.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ npm install -g @finos/git-proxy@1.0.0 | |
$ npm install -g @finos/git-proxy@1.1.0 |
package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@finos/git-proxy", | |||
"version": "1.0.0", | |||
"version": "1.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"version": "1.0.1", | |
"version": "1.1.0", |
@coopernetes @maoo (cc)
0cb1972
to
e227f26
Compare
@JamieSlome should be good for review. Let's open a tracking issue re: #287 (comment) |
@coopernetes - I've opened #293 for documentation on configuration options. I'm a bit confused about how to test this, can you provide the steps I should run in the terminal? |
Try using |
This comment was marked as outdated.
This comment was marked as outdated.
b2c0c01
to
06b4c1d
Compare
Latest changes are available now @JamieSlome @maoo - please take a look and let me know if any other updates are needed. |
I've tested the README steps, including the I'd suggest to tweak the https://github.com/finos/git-proxy#clone-the-repository section and change it to:
Alternatively, we could do @coopernetes @JamieSlome - WDYT? |
@maoo gonna leave the documentation updates to #299. Would like this PR to remain focused on closing #183 with @JamieSlome updates to follow |
@coopernetes - sounds good. I've taken the crux of all of your documentation improvements in the README and added to the documentation PR 👍 |
Any additional changes to make before merging? |
LGTM! @JamieSlome - if you're ok with it, we may proceed with the merge? |
LGTM! 🍰 |
|
✅ Deploy Preview for endearing-brigadeiros-63f9d0 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@coopernetes - can we get your e-mail address CLA approved or address the commit directly? ❌ The email address for the commit (06b4c1d) is not linked to the GitHub account... |
dca4fa4
to
bd79fd0
Compare
- add "bin" to package.json to support running git-proxy as an executable. Largely taken from # 184 and fixes # 183 - added --config and --validate command line flags via yargs. These will allow custom user configurations with a default behaviour of loading from the current working dir and/or default settings. --validate uses JSON Schema to validate the config. - update docs to reflect new CLI args and additional details of running the app via npx - load default settings from a module instead of explicit file path - add test for default & user setting merging - bump @finos/git-proxy to 1.1.0 - Remove old X.509 certificate and private key, which I assume was included previously to run git-proxy with TLS enabled via a demo. Can be re-added as needed but probably shouldn't be included in src (even if its for demo only).
bd79fd0
to
84207ae
Compare
@JamieSlome corrected and no more conflicts from #299 - should be good at this point 👍 |
feat: Make git-proxy executable, custom config file arg & validation, bump to 1.1.0
executable. Largely taken from Support
npx
usage and fix default configuration loading #184 and fixes Make installation and usage of the library easier #183allow custom user configurations with a default behaviour of loading
from the current working dir and/or default settings. --validate uses
JSON Schema to validate the config.
the app via npx
included previously to run git-proxy with TLS enabled via a demo. Can
be re-added as needed but probably shouldn't be included in src (even
if its for demo only).