Skip to content

Commit

Permalink
Merge pull request #10 from natron-io/fix_env
Browse files Browse the repository at this point in the history
Fix env
  • Loading branch information
janlauber authored Jan 30, 2022
2 parents 8564bd1 + 1454045 commit ce0fc2d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ To configure the tenant dashboard with your settings, fill your information in t

| Env Variable | Type | Description |
| -------------------------- | :----------------------------- | ---------------------------------------------------------------------------------------------- |
| `REACT_APP_CLIENT_ID:` | [string] <YOUR_CLIENT_ID_HERE> | GitHub App client ID |
| `REACT_APP_REDIRECT_URI:` | [string] <REDIRECT_URL> | GitHub App redirect URL (Should point back at the frontend, i.e. https://yourdomain.com/login) |
| `REACT_APP_API_OAUTH_URI:` | [string] <OAUTH_URL> | GitHub OAuth URL |
| `REACT_APP_CLIENT_ID` | [string] <YOUR_CLIENT_ID_HERE> | GitHub App client ID |
| `REACT_APP_REDIRECT_URI` | [string] <REDIRECT_URL> | GitHub App redirect URL (Should point back at the frontend, i.e. https://yourdomain.com/login) |
| `REACT_APP_API_OAUTH_URI` | [string] <OAUTH_URL> | GitHub OAuth URL |
3 changes: 0 additions & 3 deletions public/env-config.js

This file was deleted.

1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
content="Web site created using create-react-app"
/>
<meta name="viewport" content="initial-scale=1, width=device-width" />
<script src="%PUBLIC_URL%/env-config.js"></script>
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand Down
10 changes: 8 additions & 2 deletions src/Components/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@ import { AuthenticationContext } from "../App";

import NatronIconWhite from "./Items/NatronIconWhite";

declare global {
interface Window {
_env_: any;
}
}

export default function Login() {
const { updateAuthenticated, updateAuthenticationToken } = useContext(
AuthenticationContext
);

const apiUrl = process.env.REACT_APP_API_OAUTH_URI;
const apiUrl = window._env_.REACT_APP_API_OAUTH_URI;

const getGithubLogin = () => {
window.open(
`https://github.com/login/oauth/authorize?scope=user&client_id=${process.env.REACT_APP_CLIENT_ID}&redirect_uri=${process.env.REACT_APP_REDIRECT_URI}`,
`https://github.com/login/oauth/authorize?scope=user&client_id=${window._env_.REACT_APP_CLIENT_ID}&redirect_uri=${window._env_.REACT_APP_REDIRECT_URI}`,
"_self"
);
};
Expand Down

0 comments on commit ce0fc2d

Please sign in to comment.