Fork me on GitHub

Using the build in clojure cli is there a way to make it download all the deps? The equivalent of lein deps?


just running clojure alone will download the deps declared in deps.edn


that will start a repl


if you don't want that run clojure -Spath > /dev/null


@U050ECB92 what does -Spath do?


computes the classpath

👍 4

with the clojure/deps.edn ecosystem, is there a good reason to stuff a project with multiple components (let's say server/client binary) that don't make sense separately but are developed mostly in tandem in 1 deps.edn file or multiple?


I ask because i've currently done that with leiningen and hit a whole bunch of long-standing profile-related bugs


@lvh in JUXT/edge we use separate deps.edn files, and then use :local/root to pull them together.


On client projects (this hasn't been demo'd too much) we have designed extensive setups where the configs are factored out to make it easier to pull applications together this way.


i’m using http-kit to write a simple API server. does anyone know how to add SSL support to it directly with Clojure? by directly I mean without using an external reverse proxy (like nginx) or SSL terminator. Internal ones (i.e. inside the JVM where I could control with Clojure) are perfect


the reason i’d like to have control over the SSL part is because the API server is a test server for a custom SSL client on MCU, and we want to be able to generate new SSL certificate and have multiple SSL sockets listening with different certificates (for testing successful cases and unsuccessful cases)


This still sounds like a perfectly doable thing with nginx or other proxy:


yeah sure i’m using a configuration like that for the production server but this is for the testing server and would like direct control over ssl configuration (including certificate generation) directly from the Clojure codebase


i’ll try jetty for now but if anyone has better suggestion it would be great


The pedestal codebase might have some ready-made code you can either use directly or copy-paste

👍 4

for anyone who’s curious, i finished the exploring and got a working piece so far by using - Bouncy Castle to generate a keypair and a self-signed certificate - a KeyStore instance of type “pkcs12” to hold the certificate + private key - Jetty with a ServerConnection configured with a SslConnectionFactory and a HttpConnectionFactory to finally get a running server


not sure who else is interested but i may post a gist after cleaning the code a little bit another day

👍 8

for anyone who’s curious, i finished the exploring and got a working piece so far by using - Bouncy Castle to generate a keypair and a self-signed certificate - a KeyStore instance of type “pkcs12” to hold the certificate + private key - Jetty with a ServerConnection configured with a SslConnectionFactory and a HttpConnectionFactory to finally get a running server


where do you host your stuff ?


locally, for testing purpose


if on amazon i would recommend using alb or elb instead of doing the ssl stuff yourself ... yes it costs a little extra but is well worth the money


yeah, for another project i’m doing exactly the same--using elb for ssl termination--yet this stuff is for developing and testing the “hardware” part of a solution (an MCU controlled gateway-ish thing that connects an input device to the application server running in the cloud)


so finally the production server will be hosted behind elb as planned now, but i was trying to make the local server and want more flexibility on certificates for testing purpose


even locally, an nginx reverse proxy can alleviate lots of that pain

👍 4

Could you have a look, is this solution good enough, or am I misusing protocols this way? The problem: I have a code that reads/writes things to a serial port. There are places in program where a number of reads/writes is expected to be finished by a specific deadline (protocol description contains phrases like "if the whole data frame was not received within 1500ms, application should stop receiving it and return to idle state.") I have tried to weave the operation deadline through reading/parsing routines (the data frame cannot be read in one operation, as it contains embedded lengths), but it was awkward. At the end I bound a deadline to a port object. (edited: moved read-byte out of interface)


how can i embed values into xml files in clojure?


something like erb in ruby for example


if someone interested too 🙂


Are #, % and & valid characters in a Clojure(script) symbol? I couldn't find an official language spec, and the rules given in seem overly restrictive


Symbols begin with a non-numeric character and can contain alphanumeric characters and *, +, !, -, _, ', ?, <, > and = (other characters may be allowed eventually).


The rules given at are what is explicitly supported. The implementation does not prevent you from using other characters, but using some of those other characters can cause some use cases to break


If you are looking for an implementation of (symbol "some string") or (keyword "some string") that throws an exception if you give it a character that is outside of a particular set of characters, you will have to write it yourself or find it in some third party library.


Does that mean that using e.g. a#b$c as a variable name could potentially be broken in a future release of Clojure?


I am not the decision maker on what changes in future releases of Clojure, so can't authoritatively answer such a question, but I can say that the Clojure maintainers do a great job at maintaining backwards compatibility, and rarely make changes that break such things. They know that because the implementation allows other characters, that many people take advantage of htat.


But for example if you find that using such a variable name causes, say, printing your code or data to a file, then reading it back, to break, then if you are using characters outside of the allowed set, and that is the reason it is breaking, you will likely not get a lot of people rushing to change Clojure to make that work.


For example, if you use a space in a symbol or keyword, that will break the ability to print code/data and read it back and be equal to the original.


that makes sense, spaces are definitely off-limits


There is a Clojure JIRA issue that suggests some kinds of actions in this area -- I am forgetting whether it was only adding more documentation for Clojure, or adding a function that would check whether a proposed string was a supported symbol/keyword


Semicolons would be another thing that might be a bit grey in terms of print-read round-tripping. Probably many others.


You can easily extend printing and reading though. I've added support for spaced namespaces and symbols in some use cases where it was convenient


I was wondering because clojure-mode in Emacs highlighted a variable name foo#bar wrongly, and I couldn't find out if it was an actual bug or according to spec


And it can round-trip if you need it serialized


I don't think I've ever seen a breakage related to what are valid symbols and namespaces. Like no version of Clojure ever broke that.


So I'd say, it it works, you're probably good to go


But if you go to significant lengths, e.g. days and days of work, trying to get color highlighting "working" (whatever that means to you) for arbitrary sequences of characters, you may go mad. 🙂


thanks for the clarifications! 🙂


Is it possible to use tools.reader to read a form as a string? Preserving whitespace. I'm guessing there might be some trick with the pushback reader, but not sure.

Alex Miller (Clojure team)22:06:24

Yes, also in the Clojure reader

❤️ 4

I'm running: clj -A:cli:client -m aot some-args the client alias has both an :extra-deps and a :main-opts. I was expecting the main-opts on the command line to override those from the alias, but instead the main-opts from :client are used. Is there an order to specify them in that fixes that, or is this why -R/-C exist?

Alex Miller (Clojure team)23:06:24

This is a known issue, but using R and C should be a workaround

Alex Miller (Clojure team)23:06:55

A will always be applied last right now


ah, gotcha -- thanks 🙂