These are chat archives for ethersphere/orange-lounge

10th
Aug 2017
Viktor Trón
@zelig
Aug 10 2017 10:44
@jmozah could you look at this failing FUSE test here ethereum/go-ethereum#14951
Viktor Trón
@zelig
Aug 10 2017 12:18
@holisticode lets discuss this issue at the standup at 3pm
@/all
holisticode
@holisticode
Aug 10 2017 16:23
Regarding the template issue I tried to describe in the call this morning:
I created html templates in swarm/api/http/tmplto be used as nicer looking error pages
These are currently loaded like this:
pathPrefix := "./swarm/api/http/tmpl"
Now, if we run swarm from the cmd line insde the repo:
>$ /home/fabio/go/src/github.com/ethereum/go-ethereum/build/bin/swarm --ens-api "" --bzzaccount.....
it works
but if I am in another directory, say /home/fabio/files
holisticode
@holisticode
Aug 10 2017 16:28
and try to run >$ /home/fabio/go/src/github.com/ethereum/go-ethereum/build/bin/swarm up myfile.txt
It fails, because it will use /home/fabio/files to prepend to "./swarm/api/http/tmpl"
I've tried different approaches, using os.Getwd() and os.Executable(), and also filepath.Abs(), but none has cracked it so far for me (I may be applying wrong though)
it strikes me though that whatever we use, the moment we think to distribute a compiled binary, which has already been discussed, it will ultimately fail
won't it? because the assets are not compiled and thus don't go with the binary? and/or the binary may be anywhere on disk?
which to me suggests that one approach is to compile the resources into the binary itself
holisticode
@holisticode
Aug 10 2017 16:52
this would have the disadvantage that templates may not be easily (or at all) modified, like for branding gateways
another good option is to use $GOPATHand complete the location from there, while this option however may have issues with compiled binaries again
Viktor Trón
@zelig
Aug 10 2017 17:28
this is only relevant for the default pages, for custom pages, you specify an absolute path on the command line
Viktor Trón
@zelig
Aug 10 2017 17:35
@holisticode what you are looking for is the ___file___ equivalent in golang
_, filename, _, _ := runtime.Caller(1)
currentDirAbsPath := path.Dir(filename))
^ but as we said, this wont work with shipped binary
so I opt for doc-stringing the default templates. nothing fancy anyway
Aron
@homotopycolimit
Aug 10 2017 19:51
@holisticode When I wrote "did you mean index.html", that was only a 'cartoon'. All we need is to default to ?list=true behaviour when we call the manifest without a path and there is no default entry.
I admit that "did you mean i?" and "did you mean ndex.html?" are not that nice, but it's still better than status quo
holisticode
@holisticode
Aug 10 2017 21:05
@holisticode what you are looking for is the ___file___ equivalent in golang
indeed
so I opt for doc-stringing the default templates. nothing fancy anyway
@zelig this is storing the templates as a string right? then use template.Parse instead of template.ParseFilesright?
I currently have 3 files only, so seems doable
holisticode
@holisticode
Aug 10 2017 21:17
hmmm, rather seems to mean Godoc