Fork me on GitHub
#portkey
<
2017-10-11
>
cgrand11:10:56

So the problem was that something (someone?) reloaded the portkey.ouroboros namespace

baptiste-from-paris11:10:49

you made it to Baltimore ?

cgrand12:10:09

still in Heathrow, boarding for Baltimore in 1 2 hour and a half

baptiste-from-paris12:10:52

are you talking there ?

cgrand12:10:08

No, hosting an unsession on unrepl

baptiste-from-paris12:10:32

unsession of unrepl’s

cgrand12:10:34

(first time at a conf as a regular attendee)

baptiste-from-paris12:10:50

that’s nice too ! and talking about portkey? too soon ?

cgrand12:10:43

yeah too soon, let’s target a proper talk next year 😄

baptiste-from-paris12:10:30

I’d love to use om-next with portkey for a demo

baptiste-from-paris12:10:02

what do you think about allowing resource directory instead of files

cgrand12:10:28

and adding all files in the directory (and subdirs?) as resources?

baptiste-from-paris12:10:03

main example would be assets file like css/js/html/img

cgrand12:10:02

ok except that you formulated your request as “allowing resource directory instead of files” and I’m ok for “allowing resource directory in addition to files”

cgrand12:10:22

ssl stuff is getting me crazy

cgrand12:10:45

Let’s train a braindump: • these are JDK classes so we don’t have control on the version

cgrand12:10:23

• public ifaces are mostly write-only • impl varies a lot

baptiste-from-paris12:10:16

back to the loader problem or #’wrapper or something else ,

cgrand12:10:34

back to using clj-http in portkey

baptiste-from-paris12:10:27

• these are JDK classes so we don't have control on the version => fix a jdk version for now

cgrand13:10:06

as time pass the problem is going to get bigger

cgrand13:10:28

(and if the first thing you ask your user is to install a specific JDK....)

cgrand13:10:26

The root of the problem is clj-http.core/get-conn-mgr.

baptiste-from-paris13:10:31

yes indeed, and to be honest I am not confortable enough with portkey to realize how big the problem is

cgrand13:10:08

as an optimization default values are allocated when the clj-http.conn is loaded

cgrand13:10:15

and these values depends on JDK version, security/crypto settings and moon phase

cgrand13:10:45

especially moon phase

baptiste-from-paris13:10:09

that’s what I was going to say, I remember having to turn off SSL with Google client api and portkey

baptiste-from-paris13:10:21

because of (java.security KeyStore)

cgrand13:10:39

The Java one?

baptiste-from-paris13:10:51

yes, let me find you pieces of code

baptiste-from-paris13:10:06

this code works fine localy =>

(defn gmail-service [app-name account-id file-path account-user]
  (let [transport (.. (NetHttpTransport$Builder.)
                      (trustCertificates (GoogleUtils/getCertificateTrustStore))
                      (build))
        jackson (JacksonFactory/getDefaultInstance)
        credentials (.. (GoogleCredential$Builder.)
                        (setTransport transport)
                        (setJsonFactory jackson)
                        (setServiceAccountId account-id)
                        (setServiceAccountPrivateKeyFromP12File (File. file-path))
                        (setServiceAccountScopes (GmailScopes/all))
                        (setServiceAccountUser account-user)
                        (build))]
    #_(.refreshToken credentials)
    (.. (Gmail$Builder. transport jackson credentials)
        (setApplicationName app-name)
        (build))))

baptiste-from-paris13:10:12

it let’s you create a gmail-service with a g-suite accounte (pro) and do pretty-much what ever you want with your g-suite account

baptiste-from-paris13:10:22

but it does not work on portkey

baptiste-from-paris13:10:26

because of this line

baptiste-from-paris13:10:39

(trustCertificates (GoogleUtils/getCertificateTrustStore))

cgrand13:10:51

Clojure is 10yo, don’t use .. anymore

baptiste-from-paris13:10:15

i’am addicted to CLJ for a year ^^

baptiste-from-paris13:10:42

and this getCertificateTrustStore does this =>

baptiste-from-paris13:10:52

public static synchronized KeyStore getCertificateTrustStore()
      throws IOException, GeneralSecurityException {
    if (certTrustStore == null) {
      certTrustStore = SecurityUtils.getJavaKeyStore();
      InputStream keyStoreStream = GoogleUtils.class.getResourceAsStream("google.jks");
      SecurityUtils.loadKeyStore(certTrustStore, keyStoreStream, "notasecret");
    }
    return certTrustStore;
  }

cgrand13:10:05

It’s an opinion but -> allows to mix fns and methods, and force you to prefix methods by . making it more locally obvious it’s interop

baptiste-from-paris13:10:33

ok, thx. will try this way then

baptiste-from-paris13:10:59

and loadKeyStore fails

baptiste-from-paris13:10:11

because SecurityUtils.getJavaKeyStore(); returns null

baptiste-from-paris14:10:19

I have to trie it again but I think that java.security.getInstance was failing

baptiste-from-paris14:10:36

I’ll check tomorrow morning what this one returns = clj-http.conn-mgr/get-keystore

baptiste-from-paris19:10:34

I don’t know if It helps or not