configurar js usando variables de entorno

This commit is contained in:
f 2021-01-25 16:28:12 -03:00
parent d7918eba3b
commit 0cfdd63542
7 changed files with 114 additions and 8 deletions

View file

@ -1,11 +1,15 @@
plugins: plugins:
- jekyll-order - jekyll-locales
- jekyll-relative-urls - jekyll-relative-urls
- jekyll-dotenv
- jekyll-include-cache
- jekyll-linked-posts
- jekyll-commonmark
- jekyll-feed
- jekyll-order
- jekyll-data
- jekyll-seo-tag - jekyll-seo-tag
- jekyll-images - jekyll-images
- jekyll-include-cache
- jekyll-locales
- jekyll-linked-posts
- sutty-liquid - sutty-liquid
markdown: CommonMark markdown: CommonMark
commonmark: commonmark:

6
_includes/env.html Normal file
View file

@ -0,0 +1,6 @@
<script async type="text/javascript">
window.env = {
AIRBRAKE_PROJECT_ID: {{ site.env.AIRBRAKE_PROJECT_ID }},
AIRBRAKE_PROJECT_KEY: '{{ site.env.AIRBRAKE_PROJECT_KEY }}'
}
</script>

View file

@ -12,8 +12,11 @@
<link href="assets/css/styles.css" rel="stylesheet"> <link href="assets/css/styles.css" rel="stylesheet">
{% comment %} {% comment %}
Webpack Webpack. La configuración se pasa por variables de entorno, en
desarrollo hay que evitar el archivo .env (copiarlo de .env.example
si no existe.
{% endcomment %} {% endcomment %}
{%- include_cached env.html -%}
<script defer type="text/javascript" src="assets/js/pack.js"></script> <script defer type="text/javascript" src="assets/js/pack.js"></script>
{% comment %} {% comment %}

View file

@ -1,8 +1,8 @@
import { Notifier } from '@airbrake/browser' import { Notifier } from '@airbrake/browser'
window.airbrake = new Notifier({ window.airbrake = new Notifier({
projectId: parseInt(process.env.AIRBRAKE_PROJECT_ID), projectId: window.env.AIRBRAKE_PROJECT_ID,
projectKey: process.env.AIRBRAKE_PROJECT_KEY, projectKey: window.env.AIRBRAKE_PROJECT_KEY,
host: 'https://panel.sutty.nl' host: 'https://panel.sutty.nl'
}) })

90
assets/js/pack.js Normal file

File diff suppressed because one or more lines are too long

1
assets/js/pack.js.map Normal file

File diff suppressed because one or more lines are too long

View file

@ -56,7 +56,7 @@ Gem::Specification.new do |spec|
# Dependencias, esto se va a instalar al instalar la gema # Dependencias, esto se va a instalar al instalar la gema
spec.add_runtime_dependency 'jekyll', '~> 4' spec.add_runtime_dependency 'jekyll', '~> 4'
spec.add_runtime_dependency 'jekyll-relative-urls', '~> 0.0' spec.add_runtime_dependency 'jekyll-relative-urls', '~> 0'
spec.add_runtime_dependency 'jekyll-seo-tag', '~> 2' spec.add_runtime_dependency 'jekyll-seo-tag', '~> 2'
spec.add_runtime_dependency 'jekyll-images', '~> 0.2' spec.add_runtime_dependency 'jekyll-images', '~> 0.2'
spec.add_runtime_dependency 'jekyll-include-cache', '~> 0' spec.add_runtime_dependency 'jekyll-include-cache', '~> 0'
@ -66,6 +66,8 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'jekyll-order', '~> 0' spec.add_runtime_dependency 'jekyll-order', '~> 0'
spec.add_runtime_dependency 'sutty-liquid', '~> 0' spec.add_runtime_dependency 'sutty-liquid', '~> 0'
spec.add_runtime_dependency 'jekyll-commonmark', '~> 1.3' spec.add_runtime_dependency 'jekyll-commonmark', '~> 1.3'
spec.add_runtime_dependency 'jekyll-dotenv', '>= 0.2'
spec.add_runtime_dependency 'jekyll-feed', '~> 0.15'
# Dependencias de desarrollo # Dependencias de desarrollo
spec.add_development_dependency 'bundler', '~> 2.1' spec.add_development_dependency 'bundler', '~> 2.1'