arc icon indicating copy to clipboard operation
arc copied to clipboard

LocalStorage does not seem to work in Umbrella apps

Open suhrawardi opened this issue 8 years ago • 6 comments

Hi,

When you use Arc in an umbrella app, the application root is inconsistent. Arc with LocalStorage might store files in the storage directory related to the absolute root of your project or any of the application root paths.

We only used LocalStorage in development mode, and will change that to S3 now to work around this issue (and because it represents Prod better). But I create this ticket anyhow for the sake of completeness and might help to clarify this for some-one else.

See also: https://elixirforum.com/t/random-working-directory-in-umbrella-app/8388

suhrawardi avatar Jan 19 '18 10:01 suhrawardi

Could this problem be solved by using absolute paths? If you have your storage_dir be an absolute path, shouldn't that resolve as expected? I'm guessing you combine this with your deployment automation tool and have it take care of handling dev vs prod configs when appropriate

In any case, it might be nice to add a few lines to the docs until an actual solution is found

pedep avatar Jan 30 '18 03:01 pedep

Thx @pedep for your reaction. We ended up using an absolute path within the storage_dir, but that absolute path is used for the url generation. So the generated url includes the whole absolute path.

Maybe there is a workaround to fix the url generation that I'm not aware of?

suhrawardi avatar Jan 30 '18 07:01 suhrawardi

Not sure if there is currently, but if https://github.com/stavro/arc/pull/195 merges soon-ish, there will be :)

pedep avatar Jan 30 '18 07:01 pedep

That looks good...!

And maybe we can adapt the generated modules and use the request_path and an absolute path for the storage_dir?

suhrawardi avatar Jan 30 '18 08:01 suhrawardi

So... the url call is still using the filesystem absolute path, which makes no sense... I feel like I'm using this incorrectly, but the code really does show that the url will only use the absolute filesystem path for whatever reason...? o.O

OvermindDL1 avatar Oct 17 '18 21:10 OvermindDL1

I have hit this same snag and currently setting up for use with S3. I would like to manage file storage locally so this is not my ideal setup. A fix would really come in handy :-)

churcho avatar Oct 21 '18 14:10 churcho