Fork me on GitHub
#boot
<
2016-08-04
>
richiardiandrea00:08:00

@micha is that cljs-console?

richiardiandrea00:08:22

I btw use that and I like it a lot

richiardiandrea00:08:29

yes it is in lambone as well

richiardiandrea00:08:25

there is one little thing to be careful of, a dot in var name...I opened an issue there

micha00:08:38

basically as long as i'm computing i'm happy. when i'm playing with build options i'm annoyed šŸ™‚

kenny00:08:31

I have no idea how I haven't see that lib before. That pretty much solves the problem that led me to start this discussion šŸ˜›

micha00:08:31

@richiardiandrea: oh nice, i'll fix that

richiardiandrea00:08:17

thanks! I was thinking of a warning, just because you won't see them as env vars, not a big deal anyways

micha00:08:49

it could support the _DOT_ syntax, perhaps

richiardiandrea00:08:35

yes that was a good idea as well, basically this is good when using cprop for instance

richiardiandrea00:08:02

that has _ for going one level deeper in the map nesting and . for replacing a -

micha00:08:38

what is cprop?

richiardiandrea00:08:03

it's environ competitor

richiardiandrea00:08:21

by totilius (aka -> mount)

micha00:08:48

yeah the env thing is as simple as can be and still be useful

micha00:08:59

so the dot might be too much for it

micha00:08:51

the thinking was that you can still use system/setproperty

micha00:08:55

and so on

richiardiandrea00:08:10

when-not + warning

micha00:08:15

ah yeah i remember now

richiardiandrea00:08:37

because you won't see it in the results and you might wonder why and spend some time banging your head

micha00:08:54

haha right

micha00:08:26

perhaps a note in the readme

micha00:08:42

because there will always be things with dots in them in the JVM properties

micha00:08:48

so you'd get the warning every time

richiardiandrea00:08:06

Micha btw why do we filter

richiardiandrea00:08:41

ah yes, because then it becomes a symbol

micha00:08:18

yeah because defining a var with a dot in the name is tricky

micha00:08:48

foo.bar isn't a valid symbol in sh either

micha00:08:56

it seems a lot simpler to not even support such complex configurations

micha00:08:25

like my applications usually have a handful of settings that are configured in the deployment

micha00:08:55

and regular environment variables in the upstart script seem to me to be very easy to deal with

micha00:08:12

then in my application code i may do setProperty or whatever

micha00:08:57

but like if i need to configure which sql server to connect to i can just make a SQL_HOST env var

richiardiandrea00:08:07

yes I do that too, but for instance there is a log4j2 property to set a custom conf

richiardiandrea00:08:20

and some other I don't remember

richiardiandrea00:08:36

but I use env/def mostly for dev in my profile.boot

micha00:08:47

interesting

micha00:08:38

we usually make a namespace that uses env/def, like app.config

micha00:08:54

that way we can get good error messages when something isn't set

micha00:08:11

and then the application components just refer to vars in there

richiardiandrea00:08:19

typical example here:

(case ~type
          "prod" (env/def
                   database_name "db-name"
                   database_username ""
                   database_password "")
          "test" (env/def
                   database_name "db-name-test")
          (env/def
            conf "external-config.edn"
            database_name "db-name"
            database_username ""
            database_password ""))

micha00:08:16

usually i'll have a few environment.env files

micha00:08:27

and in my shell i do . dev.env for instance

micha00:08:33

that will set the env vars

micha00:08:40

then i can just do boot repl or whatever

richiardiandrea00:08:50

yes, you do an extra step šŸ˜„

micha00:08:15

it's less code though

richiardiandrea00:08:54

and my command like is messy: boot dev -t dev

richiardiandrea00:08:13

that defaults to dev of course

micha00:08:16

one thing in favor of the env file bash approach is like if you need aws resources

micha00:08:26

like you might have a script that creates an sqs queue for you to use

micha00:08:48

the shell script that creates the resources could also emit the env var settings

micha00:08:03

so you could do like eval "$(make-resources ...)" in bash

micha00:08:17

or make-resources ... > dev.env

micha00:08:36

then tear everything down when you're done what you're doing

richiardiandrea00:08:56

yes very true, here I basically use env/def every time I need to setup a var programmatically, using boot

richiardiandrea00:08:15

(defn set-env-props! []
          (let [postgres-db (get (env/env) "database_name")]
            (case ~type
              "prod" (env/def
                       database_jdbc.url ""
                       search_url "")
              "test" (env/def
                       database_jdbc.url (str "jdbc:postgresql://" (d/endpoint-with-port! "postgres") "/" postgres-db "-test")
                       search_url (str "http://" (d/endpoint-with-port! "elasticsearch")))
              (env/def
                database_jdbc.url (str "jdbc:postgresql://" (docker/endpoint-with-port! "postgres") "/" postgres-db)
                search_url (str "http://" (d/endpoint-with-port! "elasticsearch"))))))

richiardiandrea00:08:34

more code as you said šŸ™‚

micha00:08:08

i guess i do a lot of stuff in bash anyway, so it's natural for me to think in a certain way

richiardiandrea00:08:16

and another disadvantage is that I need to wrap everything in conch

richiardiandrea00:08:37

no but you are right, this is bash anyways

kurt-yagram08:08:41

boot push provides a :repo-map option, where you can define a repository map (makes perfect sense). However, what if you have more than 1 repo-map? Defining the repo-map the same way you would define repositories

[["whatever" {:url "cool-url"}]]
doesn't work (makes sense as well, it's not a map). Can boot push take multiple repo-maps?

kurt-yagram08:08:57

so you can do like

boot push -r whatever

juhoteperi08:08:57

@kurt-yagram: repo-map options is mostly for defining e.g. credentials for single deploy repository

juhoteperi08:08:31

if you need to deploy to multiple repositories you would define all in set-env! :repositories and use multiple push tasks: (comp (push :repo "a") (push :repo "b"))

kurt-yagram08:08:49

allright, the thing is: I wanted to have the repositories per task, and repo-map looked like a nice solution - but it didn't work out since I wanted to give a -r option to push. Now, I just defined 2 other tasks, in each of them setting a different repo-map for the push command. Thanks anyway

kurt-yagram09:08:24

how can you split tasks over different files? Now, I tried to do

(load "versioning")
, but I get an error it can't find my file:
java.io.FileNotFoundException: Could not locate boot/versioning__init.class or boot/versioning.clj on classpath. 
. The file boot/versioning.clj is present from the same directory of build.boot.

sekao14:08:13

hey all, iā€™m revisiting the issue that is preventing me from supporting Boot in nightcode. if anyone has any new ideas for possible workarounds, please let me know. iā€™d love to get it into the next release. https://github.com/oakes/boot-clj-issue

dominicm14:08:07

I'd love to see it in the next release. Nightcode is really cool.

micha17:08:57

@kurt-yagram: why not use clojure.core/require?

micha17:08:36

(require 'versioning)

borkdude18:08:28

is it possible to limit the amount of lines printed in a text in boot?

borkdude18:08:38

for example: (print (apply str (repeat 100 "hoi\n")))) only prints 3 lines instead of 100?

flyboarder21:08:14

Does anyone know how to get the offline status of boot? I'd like to pass that onto a task.

flyboarder21:08:52

Wait nvm it's in the env