Skip to content

Commit 4d34e57

Browse files
authored
Merge pull request #143 from ror-community/env-vars-css
add-on to inject base URL into index.html
2 parents 71c2071 + e9c0d59 commit 4d34e57

File tree

8 files changed

+32
-2
lines changed

8 files changed

+32
-2
lines changed

.env.dev

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
API_URL=https://api.dev.ror.org
22
SENTRY_DSN=https://1c334995f85448b1afa561c8ccf13791@sentry.io/1422597
3+
BASE_URL=https://dev.ror.org

.env.production

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
API_URL=https://api.ror.org
22
SENTRY_DSN=https://1c334995f85448b1afa561c8ccf13791@sentry.io/1422597
3+
BASE_URL=https://ror.org

.env.staging

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
API_URL=https://api.staging.ror.org
22
SENTRY_DSN=https://1c334995f85448b1afa561c8ccf13791@sentry.io/1422597
3+
BASE_URL=https://staging.ror.org

app/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
<link rel="stylesheet" href="{{rootURL}}assets/vendor.css" type='text/css'>
2020

21-
<link rel="stylesheet" href="https://ror.org/css/hugo-ror.css?v4">
21+
<link rel="stylesheet" href="{{content-for 'baseURL'}}/css/hugo-ror.css?v4">
2222
<link rel="stylesheet" href="{{rootURL}}assets/ror-app.css" type='text/css'>
2323
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
2424
<link rel="icon" href="/favicon.ico" type="image/x-icon">

config/environment.js

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

33
module.exports = function(environment) {
44
const pkg = require('../package.json');
5-
5+
66
let ENV = {
77
modulePrefix: 'ror-app',
88
environment,
@@ -20,6 +20,7 @@ module.exports = function(environment) {
2020
},
2121

2222
API_URL: process.env.API_URL || "https://api.ror.org",
23+
BASE_URL: process.env.BASE_URL || null,
2324
SENTRY_DSN: process.env.SENTRY_DSN || null,
2425
VERSION: pkg.version,
2526
APP_NAME: pkg.name,

lib/base-url/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use strict';
2+
3+
module.exports = {
4+
name: require('./package').name,
5+
6+
isDevelopingAddon() {
7+
return true;
8+
},
9+
contentFor: function(type, config){
10+
if (type === 'baseURL'){
11+
return `${config.BASE_URL}`
12+
;
13+
}
14+
}
15+
};

lib/base-url/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "base-url",
3+
"keywords": [
4+
"ember-addon"
5+
]
6+
}

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,10 @@
6666
"dependencies": {
6767
"@sentry/browser": "^5.10.2",
6868
"@sentry/integrations": "^5.10.2"
69+
},
70+
"ember-addon": {
71+
"paths": [
72+
"lib/base-url"
73+
]
6974
}
7075
}

0 commit comments

Comments
 (0)