Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

root directive doesn't used #23

Closed
adzeitor opened this issue Sep 30, 2015 · 15 comments
Closed

root directive doesn't used #23

adzeitor opened this issue Sep 30, 2015 · 15 comments
Labels
enhancement ⚙ Improve an existing feature

Comments

@adzeitor
Copy link

Hi! It's again me ;)

I have this config /home/toor/www/Caddyfile ( pwd used here to show problem, original config have command hugo):

localhost {
  root ./blog
  cms {
    content public
    command pwd
  }
}

I've expected to see /home/toor/www/blog/, but

$ caddy -conf=Caddyfile 
/home/toor/www
localhost:2015

But running caddy from blog directory let it works like a charm...

I think you need to set current working dir before Run: https://golang.org/pkg/os/exec/#Command

@adzeitor
Copy link
Author

But root directive sets current dir for serving content, not for running external apps... Maybe @mholt give us a hint.

@mholt
Copy link

mholt commented Sep 30, 2015

No, that makes sense. If the site is at /home/toor/www, the hugo commands probably need to be run from that directory (or somewhere around there).

@hacdias
Copy link
Member

hacdias commented Sep 30, 2015

Caddyfile should be placed where the Hugo files are placed. The root is the content served and content is what's probably causing the main problem. This directive is used to know which folder contains the main content, the markdown files. It will only affect the links, nothing else.

@hacdias
Copy link
Member

hacdias commented Sep 30, 2015

It's not that clear in the docs, sorry. I'll change it as soon as I can. Let me know if this was the misunderstanding or if it's something else.

@adzeitor
Copy link
Author

Currently there is no way to have more than one cms with one caddy file, because users from each cms can modify files of other:

0.0.0.0:8001 {
  root ./blog1/public
  cms {
   content blog1/public
   command hugo
   args -s blog1/
  }
}

0.0.0.0:8002 {
  root ./blog2/public
  cms {
   content blog2/public
   command hugo
   args -s blog2/
  }
}

@hacdias
Copy link
Member

hacdias commented Sep 30, 2015

Oh... I see. What do you want is to have a a directive where you put the path of the "static-generator-content-things" and it runs there, isn't it? I could (or even you!) create that, it could be optional. You do you think?

@adzeitor
Copy link
Author

Oh... I see. What do you want is to have a a directive where you put the path of the "static-generator-content-things" and it runs there, isn't it?

maybe, but this makes things complicated: root, workdir, content (not very useful) ...

search plugin use search [directory] endpoint { ... }

directory is a path within the site (can be a regular expression) that should be indexed. Default is site root.

git plugin also use similar thing. Anyway current dir for executing could be root or user defined, but not a caddy running directory.

@hacdias
Copy link
Member

hacdias commented Sep 30, 2015

@adzeitor it can't be root because those are the served files. What do you suggest?

@hacdias
Copy link
Member

hacdias commented Sep 30, 2015

Oh... I figured out that content is always the same as root. So, I can remove content variable and add workdir or something like that.

@hacdias hacdias added the enhancement ⚙ Improve an existing feature label Sep 30, 2015
@adzeitor
Copy link
Author

It can be root with rewrite 😄

I think it is better root than caddy workdir (if root is defined).

What do you suggest?

This syntax inspired by git and search plugin for consistency:

root /home/toor/blog1/public
cms /home/toor/blog1/ {
  command ...
}

@hacdias
Copy link
Member

hacdias commented Sep 30, 2015

So:

root [path/to/public/folder]
cms [path/to/execute/things] {
    styles  file
    command cmd
    args    args...
}

I'm thinking about merging command and args too. What do you think?

@adzeitor
Copy link
Author

I like it.

merging command and args too

Good because it works in the same way as startup directive.

@hacdias
Copy link
Member

hacdias commented Sep 30, 2015

I'm making the changes and I found out that there's a mistake here. content =/= public. Content is the folder where are the content files like pages and posts. Public is the generated HTML. So the content directive should be used.

@hacdias
Copy link
Member

hacdias commented Sep 30, 2015

I'll update the docs to make that clearer.

hacdias added a commit that referenced this issue Sep 30, 2015
@hacdias
Copy link
Member

hacdias commented Sep 30, 2015

Try executing from source to see if is good!

@hacdias hacdias closed this as completed Oct 1, 2015
hacdias added a commit that referenced this issue Jul 18, 2017
hacdias added a commit that referenced this issue Jul 18, 2017
hacdias added a commit that referenced this issue Jul 18, 2017
hacdias added a commit that referenced this issue Jul 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ⚙ Improve an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants