An open API service indexing awesome lists of open source software.

https://github.com/hatappo/netlifycms-oauth-server

Netlify CMS - GitHub Backend OAuth2 server for Firebase Functions. It's written in Clojurescript / Node.js / Express
https://github.com/hatappo/netlifycms-oauth-server

clojurescript firebase-functions netlify-cms netlifycms oauth2 shadow-cljs

Last synced: 4 months ago
JSON representation

Netlify CMS - GitHub Backend OAuth2 server for Firebase Functions. It's written in Clojurescript / Node.js / Express

Awesome Lists containing this project

README

          

# netlifycms-oauth-server

This is GitHub OAuth2 server for [NetlifyCMS](https://www.netlifycms.org/) , which is intended to deployed to [Firebase Functions](https://firebase.google.com/docs/functions).

## Set up development environment

Fork and clone this repo. Then,

```sh
npm install
```

## Set up GitHub OAuth app

Vist https://github.com/settings/developers (or `https://github.com/organizations//settings/applications`) and register a new OAuth application.

- `Application name` - free
- `Homepage URL` - free
- `Application description` - free
- `Authorization callback URL` - `https://asia-northeast1-.cloudfunctions.net/oauth/callback`

If you don't have Firebase projects yet here, you can change the callback url after created it.

## Configure Netlify CMS

In yours projects modify `config.yml` file:

```yaml
backend:
name: github
repo: /netlifycms-oauth-server
branch: main # Or branch you want to update
base_url: https://asia-northeast1-.cloudfunctions.net
auth_endpoint: /oauth/auth
```

## Set up Firebase Functions

```
npx firebase login
npx firebase use
npx firebase functions:config:set oauth.client_id= oauth.client_secret=
```

## commands

### local development

build

```
npx shadow-cljs watch app
```

run server

```
node out/netlifycms-oauth-server.js
```

connect repl

```
npx shadow-cljs cljs-repl
```

### local Firebase Functions emulator server

```sh
cp package.json functions/
cp .runtimeconfig.json functions/
# or
# npx firebase functions:config:get > functions/.runtimeconfig.json

npx shadow-cljs compile functions

npx firebase login
npx firebase use
npx firebase serve -p 5001
```

### release to Firebase Functions

build release js file

```
npx shadow-cljs release functions
cp package.json functions/
```

deploy to Firebase Function

```
npx firebase use
npx firebase deploy --only functions:oauth
```

### release simple example one for debug

```
npx shadow-cljs release example-functions
cp package.json functions/
npx firebase deploy --only functions:example
```

## TODOS

- [ ] CI/CD. But this type of app is not frequently released.
- [ ] Other Git Service support e.g. GitLab, GitHub Enterprise