statamic / ssg

The official Statamic Static Site Generator
234 stars 24 forks source link

SSG should be allowed to generate site with Statamic Protect #14

Closed tao closed 3 years ago

tao commented 4 years ago

I am planning to use a Statamic 3 server for my team, and generate a static website for general users to view. I would like to protect the admin site because it might have content we don't want to push to the static site yet or let other users see yet.

I set up Statamic Protect to use the password scheme, however when I try generate the static site it blocks and redirects the pages.

/journals/camelot/2013/2373 (Resulted in a redirect to http://localhost/!/protect/password?token=2XQ7QLvrrZx8BptdTMC90UZ8R3gjx8Ze)

How can we work around this or can SSG detect the Protect scheme and generate the static site regardless? I don't believe the redirect form would work on a static site anyway.

tao commented 4 years ago

Maybe the best option would be to use different environment variables, which would allow the CI/CD pipeline to generate the static website? Might be something that's worth mentioning in the documentation if that's the simpler option.

tao commented 3 years ago

To overcome this I use an environment variable, which I can toggle on and off when I need to generate the static website during CI stages. This works well enough for now so I'm going to close the issue.

    /*
    |--------------------------------------------------------------------------
    | Default (or site-wide) Scheme
    |--------------------------------------------------------------------------
    |
    | The default scheme will be applied to every page of the site.
    | By default, you probably won't want to protect anything
    | at all, but you are free to select one if necessary.
    |
    */

    'default' => env('PROTECT_SCHEMA', 'password'),