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

Overwrite users in environment configuration #2450

Closed
heino-vdbh opened this issue Apr 15, 2019 · 10 comments
Closed

Overwrite users in environment configuration #2450

heino-vdbh opened this issue Apr 15, 2019 · 10 comments
Assignees

Comments

@heino-vdbh
Copy link

I need to change admin password in staging and prod.
Can I overwrite users in the environment configuration?
I have tried to put the users in user/localhost/accounts but it doesn't work.

@mahagr
Copy link
Member

mahagr commented Apr 15, 2019

You will need to override accounts:// stream in the stream configuration for that site.

@heino-vdbh
Copy link
Author

Can you give me an example for that?

@mahagr
Copy link
Member

mahagr commented Apr 15, 2019

Here is documentation from the old way: https://learn.getgrav.org/16/advanced/multisite-setup

The new way is basically the same, but you can use streams.yaml where you have something like:

schemes:
  accounts:
    paths:
      - user/site/accounts

@heino-vdbh
Copy link
Author

Do I have to use the Multisite Setup? Current I use only the Automatic Environment Configuration https://learn.getgrav.org/16/advanced/environment-config

@mahagr
Copy link
Member

mahagr commented Apr 16, 2019

You can just throw the streams.yaml file into your site config. But the ideas in the docs apply.

@heino-vdbh
Copy link
Author

I put the ./user/localhost/config/streams.yaml with

schemes:
  accounts:
    paths:
      - user/localhost/accounts

and I put the user.yaml to user/localhost/accounts but it didn't work

@mahagr mahagr self-assigned this Apr 17, 2019
@dschoschu
Copy link
Contributor

dschoschu commented Jan 13, 2021

Any news here. I believe I encountered the same problem here:

I am currently reworking my multisite. During that I wanted to move some files to sub directories as cleanup.

A brief structure

user/
- accounts/
- sites/
- - site1/
- - site2/

Both sites are mostly independent, but the users are the same. As the user stream is the site1/site2 directly, I wanted to overwrite the account stream. But as soon as I did that, Grav did not find any user and I got the redirected to create the first admin user.

My current workaround is to set "user" as additional path in the user stream.

I tried both ways. Setting it via config/streams.yaml and the "old way" as you called it in the setup.php. The Grav version is the current 1.7.RC20. But as I recall it also happened on 1.6.

Dumping the locator shows the seemingly correct path in the schemes.

@mahagr
Copy link
Member

mahagr commented Jan 15, 2021

To me this works:

schemes:
  account:
    type: 'Stream'
    force: true
    prefixes:
      '': 'user/accounts'

@dschoschu
Copy link
Contributor

I think I got it working now. The solution seems to be moving to the "new" method of setting the streams using the streams.yaml and the environment variables. Using the old method (returning an array in setup.php) seems not to be working correctly. As far as I debugged it, the method initializeLocator is called four times. On the first call the values are right, but as soon the second call is made the array from setup.php seems to be ignored for some values and they will be reset to default.

Hopefully this will help you.

@mahagr
Copy link
Member

mahagr commented Jan 18, 2021

It "works" also from setup.php, but there's a caveat: it only serves as an initial configuration and as the variables are overridden in system/config/streams.php, it won't work. I removed the system file so that the examples should work again. I also updated documentation to prefer schemes.yaml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants