From c1456a5b63b58791015bb3beac8f0ee0f1ff7abd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment?= <cpartiot@gmail.com>
Date: Fri, 5 Oct 2018 13:07:14 +0200
Subject: [PATCH] use sample files

---
 .gitignore                         |  2 ++
 Makefile                           |  9 +++++++--
 src/config.pug                     |  2 +-
 src/config.sample.pug              |  3 +++
 src/dependencies.pug               |  5 ++---
 www/oidc-client-config.json        |  3 +--
 www/oidc-client-config.sample.json | 10 ++++++++++
 7 files changed, 26 insertions(+), 8 deletions(-)
 create mode 100644 src/config.sample.pug
 create mode 100644 www/oidc-client-config.sample.json

diff --git a/.gitignore b/.gitignore
index b9179d0b..03780aac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,10 @@
 /node_modules
+/src/config.pug
 /www/index.html
 /www/styles/
 /www/scripts/
 /www/lib/
+/www/oidc-client-config.json
 !/www/lib/sib-core
 !/www/lib/sib-router
 !/www/lib/sib-chat
\ No newline at end of file
diff --git a/Makefile b/Makefile
index fbd04908..f593ba02 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ clean:
 	git clean -fXd
 
 
-install: node_modules copy_lib submodules
+install: node_modules copy_lib copy_samples submodules
 
 submodules:
 	git submodule init
@@ -37,6 +37,11 @@ node_modules:
 copy_lib:
 	@node copy_lib.js
 
+# sample
+copy_samples:
+	@cp -n src/config.sample.pug src/config.pug
+	@cp -n www/oidc-client-config.sample.json www/oidc-client-config.json
+
 # pug
 $(DIST_DIR)/index.html: src/index.pug $(wildcard src/*.pug src/*/*.pug)
 	@echo pug: $< ➜ $@
@@ -56,4 +61,4 @@ $(DIST_DIR)/%.js: src/%.js
 sync:
 	rsync -rv www/* staging-app@ssh-staging-app.happy-dev.fr:~/staging-app.happy-dev.fr/
 
-.PHONY: default install submodules copy_lib build watch serve clean
\ No newline at end of file
+.PHONY: default install submodules copy_lib copy_samples build watch serve clean
\ No newline at end of file
diff --git a/src/config.pug b/src/config.pug
index 8a83ec03..0e48b693 100644
--- a/src/config.pug
+++ b/src/config.pug
@@ -1,3 +1,3 @@
 //- var sdn = process.env.SDN || 'http://127.0.0.1:8000'
-- var sdn = process.env.SDN || 'https://test-paris.happy-dev.fr'
+- var sdn = process.env.SDN || '127.0.0.1:8000'
 - var cdn = process.env.CDN || 'https://cdn.happy-dev.fr'
\ No newline at end of file
diff --git a/src/config.sample.pug b/src/config.sample.pug
new file mode 100644
index 00000000..0e48b693
--- /dev/null
+++ b/src/config.sample.pug
@@ -0,0 +1,3 @@
+//- var sdn = process.env.SDN || 'http://127.0.0.1:8000'
+- var sdn = process.env.SDN || '127.0.0.1:8000'
+- var cdn = process.env.CDN || 'https://cdn.happy-dev.fr'
\ No newline at end of file
diff --git a/src/dependencies.pug b/src/dependencies.pug
index deb579dc..7791200c 100644
--- a/src/dependencies.pug
+++ b/src/dependencies.pug
@@ -1,10 +1,9 @@
 // Scripts
+//- script(src="https://unpkg.com/@webcomponents/webcomponentsjs@1.2.7/webcomponents-loader.js")
 script(src="/lib/webcomponentsjs/webcomponents-loader.js")
 //- script(src="lib/html-imports.js")
 
-//- script(src="https://unpkg.com/@webcomponents/webcomponentsjs@1.2.7/webcomponents-loader.js")
 script(src='/lib/sib-chat/3rdparty/sib-oidc-client.js')
-
 script(src="/scripts/index.js")
 
 // Stylesheets
@@ -26,4 +25,4 @@ link(rel='import', href='/lib/sib-chat/sib-chat.html')
 //- cdn
   link(rel='import', href="https://cdn.happy-dev.fr/sib-core/sib-display.html")
   link(rel='import', href="https://cdn.happy-dev.fr/sib-router/sib-router.html")
-  //- link(rel='import', href="https://cdn.happy-dev.fr/sib-chat/sib-chat.html")
\ No newline at end of file
+  link(rel='import', href="https://cdn.happy-dev.fr/sib-chat/sib-chat.html")
\ No newline at end of file
diff --git a/www/oidc-client-config.json b/www/oidc-client-config.json
index 5cbb8d85..83cabe4c 100644
--- a/www/oidc-client-config.json
+++ b/www/oidc-client-config.json
@@ -7,5 +7,4 @@
   "automaticSilentRenew": true,
   "silent_redirect_uri": "https://staging-app.happy-dev.fr",
   "loadUserInfo": true
-}
-
+}
\ No newline at end of file
diff --git a/www/oidc-client-config.sample.json b/www/oidc-client-config.sample.json
new file mode 100644
index 00000000..3fc26ae9
--- /dev/null
+++ b/www/oidc-client-config.sample.json
@@ -0,0 +1,10 @@
+{
+  "authority": "https://test-paris.happy-dev.fr/openid/",
+  "client_id": "125356",
+  "redirect_uri": "http://127.0.0.1:3000",
+  "response_type": "id_token token",
+  "scope": "openid profile email",
+  "automaticSilentRenew": true,
+  "silent_redirect_uri": "http://127.0.0.1:3000",
+  "loadUserInfo": true
+}
\ No newline at end of file
-- 
GitLab