thojanssens1
Hello,
I want to specify the path to the priv directory for user file uploads; I found this code:
:code.priv_dir(:my_app)
But it points to the priv directory in the _build directory:
‘c:/projects/my_app/_build/dev/lib/my_app/priv’
But then I was wondering, what is the difference with the priv directory in the root folder? I.e.
‘c:/projects/my_app/priv’
Are those two directories somehow in sync? Can I use the one or the other interchangeably?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
kokolegorille
We are just in sync, I had the same thoughts.
But it’s not the same priv directory… the one You mention is for release. While the other is being used when starting the project with mix.
If You run this as a release, You can use
When it is used with mix, You should use priv from application root folder, because it is served by plug static.
I configured a path for dev and test, and when it is not configured… for example in prod, I use this
This allows me to have a different config between dev (mix) and prod (release).
It’s not the only way, You can also test if Mix is available with.
I found it was more elegant to define a static path for dev and test only than checking if Mix is available.
thojanssens1
Why doesn’t
Application.app_dirhandle that?I.e. if the app is run by mix, point to the root folder instead of the
_build/dev/lib/...folder. You have to set some configs, add code, … to handle that; if the Elixir core function detected it that would have avoided all this code.kokolegorille
I am not a Core Team member
But it’s easy to check how You run your application.
kip
In
devmode, themy_app/privdir is symlinked to tomy_app/_build/dev/..... Inprodit is copied to that dir. It’s actually controlled by thebuild_embeddedkey in theproject/0function inmix.exs.This is because Elixir runs your compiled code which is stored in the
my_app/_builddirectory. Sinceprivis build artifact, it is located there as well.I think its better to consider the
:code.priv_dir/1to be part of the build process, not part of the runtime environment. And therefore I’d suggest considering an alternative location for your uploads.