No proc {} wrapper needed for a literal string.
The proc is creating a code block or procedure that will be run to get the
value, and it’s purpose is to defer assignment,
Typically where the AppConfig assignment is based on another value from
AppConfig.
That way, if a variable is changed from it’s default in config.rb, the
dependent variable will also be changed.
For example, from config-defaults.rb:
AppConfig[:db_max_connections] = proc { 20 + (AppConfig[:indexer_thread_count]
* 2) }
I have used proc {} wrapped around assignments in my config.rb , but I’m not
sure that usage is even necessary:
Now that I think about it, it may only be needed in config-defaults to pick up
changes added to config.rb .
Once config.rb is being executed, there is already an AppConfig created with
those defaults, and as long as
your additions to config.rb are sequential, I don’t think the proc matters
most* of the time.
(*) ‘most of the time’ :
Where I have needed it is in adding:
AppConfig[:hostname] = { Socket.gethostname }
# …
AppConfig[:public_proxy_url] = proc { "http://#{AppConfig[:hostname]}:8081” }
To use actual host names instead of localhost for proxy urls.
But I believe that is mostly needed to defer execution until initialization has
imported Socket module,
Because elsewhere I also assign AppConfig[:environment] to either :production
or :development
And use that in conditionals within my config.rb .
( if :production, then it’s using assigned VHOST names and https: in those
proxy settings instead of AppConfig[:hostname] )
So I’m thinking I was under the influence of some fuzzy thinking about the
initialization process when I wrote my config.rb code.
It all works as is, but now that I try to reason about it, it’s a bit off!
— Steve.
> On Aug 30, 2019, at 9:03 AM, Trevor Thornton <[email protected]> wrote:
>
> I think these are the settings in config.rb that make that work correctly
> (from the documentation):
> AppConfig[:frontend_proxy_url] = "https://staff.myarchive.org
> <https://staff.myarchive.org/>"
> AppConfig[:public_proxy_url] = "https://public.myarchive.org
> <https://public.myarchive.org/>"
>
> But we have something like this:
> AppConfig[:frontend_proxy_url] = proc { "https://staff.myarchive.org
> <https://staff.myarchive.org/>" }
> AppConfig[:public_proxy_url] = proc { "https://public.myarchive.org
> <https://public.myarchive.org/>" }
> with the URL wrapped in proc { }. So try both and see if it helps. If the
> proc { } thing works then the documentation might need to be updated.
>
> On Fri, Aug 30, 2019 at 8:47 AM Kara Hart <[email protected]
> <mailto:[email protected]>> wrote:
> Hi everyone,
> We just built a new server with openjdk 1.8.0_212; Apache/2.4.6; 5.7.26
> MySQL; CentOS Linux release 7.6.1810.
> I migrated the database from a 2.5.1 version and forced a full re-index by
> deleting the data directory contents. At the same time we installed
> certificates to start to serve the PUI and Staff UI over https. My Systems
> staff added the settings to the apache config file and I edited the config.rb
> file and entered the lines as suggested in the https setup documentation
> <https://github.com/archivesspace/tech-docs/blob/master/provisioning/https.md>.
>
>
> I'm having a problem with the AS not keeping https on the staff side when you
> click to view or edit records. I can search and get a list of result records
> in the AS staff UI and navigate around, but when I click on a record to edit
> or view I'm getting a requested resource is not found on server error.
>
> EX: a link to a record
> https://archivesstaff.wellesley.edu/resolve/edit?uri=/repositories/2/resources/51
>
> <https://archivesstaff.wellesley.edu/resolve/edit?uri=/repositories/2/resources/51>
> should redirect to
> https://archivesstaff.wellesley.edu/resources/51#tree::archival_object_15295
> <https://archivesstaff.wellesley.edu/resources/51#tree::archival_object_15295>
> but instead I get routed to insecure
> http://archivesstaff.wellesley.edu/resources/51/edit
> <http://archivesstaff.wellesley.edu/resources/51/edit>
> with error "Not Found The requested URL /resources/51 was not found on
> this server."
> If I change the last url to https, manually, it does render the edit page.
>
> Any idea with is going on or of a setting I'm missing somewhere?
> Thanks,
>
> Kara
>
>
> ~~~ Kara S. Hart
> Systems Librarian - Library & Technology Services - Wellesley College
>
> _______________________________________________
> Archivesspace_Users_Group mailing list
> [email protected]
> <mailto:[email protected]>
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
> <http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group>
>
>
> --
> Trevor Thornton
> Applications Developer, Digital Library Initiatives
> North Carolina State University Libraries
> _______________________________________________
> Archivesspace_Users_Group mailing list
> [email protected]
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Archivesspace_Users_Group mailing list [email protected] http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
