Skip to content

Commit

Permalink
fix: undefined BASE_URL value in Netlify function (#2)
Browse files Browse the repository at this point in the history
* fix: attempt 1

* fix: attempt 2

* chore(ci): add branch-deploys.yml

* chore: reset to default google midlleware
  • Loading branch information
conradbekondo authored Dec 27, 2024
1 parent 92de08e commit 74fbf6c
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 70 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/branch-deploys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Branch Deploys for Netlify

on:
pull_request:
branches:
- next
types:
- closed
push:
branches:
- next
paths:
- "netlify/functions/**/*.*"
- "src/**/*.*"
- "lib/**/*.*"
- "netlify.toml"

jobs:
build_and_deploy:
name: Build and deploy to Netlify
runs-on: ubuntu-22.04
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: package.json
- name: Install PNPM
run: npm install -g pnpm
- name: Get Store Path
id: get-store-path
run: echo "store-path=$(pnpm store path)\n" >> $GITHUB_OUTPUT
- name: Setup Cache
id: setup-cache
uses: actions/cache@v4
with:
key: ${{ runner.os }}-${{ hashFiles('**/*lock*', 'package.json') }}
restore-keys: |
${{ runner.os }}-${{ hashFiles('**/*lock*', 'package.json') }}
${{ runner.os }}-
path: |
node_modules
${{ steps.get-store-path.outputs.store-path }}
- name: Install Dependencies 📦
if: steps.setup-cache.outputs.cache-hit != 'true'
run: pnpm i
- name: Build ⚙️ & Deploy ⬆️
run: netlify deploy --alias="${{ github.ref_name }}" --build --context deploy-preview --message="${{ github.event.head_commit.message }}"
61 changes: 3 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,4 @@
# Tellme
# TellThem
[![Netlify Status](https://api.netlify.com/api/v1/badges/bbed7679-1ffd-4dad-ad22-80a6a531474d/deploy-status)](https://app.netlify.com/sites/tellthem/deploys)

This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.0.6.

## Development server

To start a local development server, run:

```bash
ng serve
```

Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.

## Code scaffolding

Angular CLI includes powerful code scaffolding tools. To generate a new component, run:

```bash
ng generate component component-name
```

For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:

```bash
ng generate --help
```

## Building

To build the project run:

```bash
ng build
```

This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.

## Running unit tests

To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:

```bash
ng test
```

## Running end-to-end tests

For end-to-end (e2e) testing, run:

```bash
ng e2e
```

Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.

## Additional Resources

For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
A social media status marketing platform.
8 changes: 8 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@
}
]
},
"staging": {
"fileReplacements": [
{
"replace": "src/environments/environment.development.ts",
"with": "src/environments/environment.staging.ts"
}
]
},
"development": {
"optimization": false,
"extractLicenses": false,
Expand Down
17 changes: 7 additions & 10 deletions netlify/functions/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,13 @@ passport.deserializeUser<number>((id, done) => {
});

const router = Router();
router.get('/', (req,res,next) => {
console.debug(process.env['URL']);
passport.authenticate('google', {
session: false,
scope: [
'profile',
'email',
]
})(req,res,next);
});
router.get('/', passport.authenticate('google', {
session: false,
scope: [
'profile',
'email',
]
}));
router.get('/callback', passport.authenticate('google', {
failureRedirect: '/auth/login', session: false,
}), (req: Request, res: Response) => {
Expand Down
4 changes: 2 additions & 2 deletions qodana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ version: "1.0"
linter: jetbrains/qodana-js:2024.2
profile:
name: qodana.recommended
include:
- name: CheckDependencyLicenses
exclude:
- name: AngularNonStandaloneComponentImports
3 changes: 3 additions & 0 deletions src/environments/environment.staging.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const environment = {
apiOrigin: location.origin
};

0 comments on commit 74fbf6c

Please sign in to comment.