greenfield | A minimal ruby web app skeleton
kandi X-RAY | greenfield Summary
kandi X-RAY | greenfield Summary
Greenfield is a minimal ruby web app skeleton.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of greenfield
greenfield Key Features
greenfield Examples and Code Snippets
Community Discussions
Trending Discussions on greenfield
QUESTION
I'm currently trying to scan over all available channels while in monitor mode to find IP traffic on open networks around me. I noticed that IP in sniffed_packet
was never true, and after some debugging, found that frames aren't being parsed properly.
I'm sniffing using this:
...ANSWER
Answered 2021-May-30 at 23:16This was a bug in Scapy. I reported it, and it was just fixed.
If you're having this issue, make sure to run the following to get the most recent version of Scapy:
QUESTION
Given two dataframes as follow:
df1:
...ANSWER
Answered 2021-May-06 at 10:35k="|".join(df2['street'].to_list())
df1=df1.assign(temp=df1['address'].str.findall(k).str.join(', '), temp1=df1['address'].str.split(",").str[-1])
dfnew=pd.merge(df1,df2, how='left', left_on=['temp','temp1'], right_on=['street',"state"])
QUESTION
I have two separate data tables that I want to find the closet zip code from one data table to the other. From the SiteZip table, I want the zip codes to loop through the ConsumerZip table to obtain the shortest distance between zip codes. I used the zipcodeR package to assign lat and long to it. The two tables are below. The first table are the locations of stores. The other table are customer locations. I want to be able to create a single table that shows the closest store for each customer. I have researched for a couple days and haven't found many requests that match what I'm looking for. Ultimately I would map the store locations with a density circle by customer location. Thank you in advance for any help you can provide.
...ANSWER
Answered 2021-Feb-05 at 19:16Here's one solution for mapping each CustomersZip$ID
with the closest StoreZip$Store
:
QUESTION
i'm looking for SKU generator function to generate SKU based on product name, combination of letter and 5 digit unique number in Postgresql.
For example :
...ANSWER
Answered 2020-Nov-13 at 22:44As suggested create a sequence. Since you have a specific value range restrict the range of the sequence. Then create a function which take a single parameter, the name, and returns the SKU. See Fiddle.
QUESTION
I'm working on a greenfield reactive project where a lot of file handling IO is going on. Is it sufficient if I write the IO code in an imperative blocking manner and then wrap them in a Mono, publish them on boundedElastic scheduler? Will the boundedElastic pool size limit the number of concurrent operations?
If this is not the correct method, can you show an example how to write bytes to a file using Reactor?
...ANSWER
Answered 2020-Jun-04 at 12:26Is it sufficient if I write the IO code in an imperative blocking manner and then wrap them in a Mono, publish them on boundedElastic scheduler?
This comes down to opinion on some level - but no, certainly not ideal not for a reactive greenfield project IMHO. boundedElastic()
schedulers are great for interfacing with blocking IO when you must, but they're not a good replacement when a true non-blocking solution exists. (Sometimes this is a bit of a moot point with file handling, since it depends if it's possible for the underlying system to do it asynchronously - but usually that's possible these days.)
In your case, I'd look at wrapping AsynchronousFileChannel
in a reactive publisher. You'll need to use create()
or push()
for this and then make explicit calls to the sink
, but exactly how you do this depends on your use case. As a "simplest case" for file writing, you could feasibly do something like:
QUESTION
I have an react js application.I am going to upload file from react js to node js using multer as multipart-formdata.It works fine as per our requirement.My question is how to send below json data along with uploaded file.
JSONData :-
...ANSWER
Answered 2020-May-10 at 10:19you can simply append the JSON to your data object as well:
data.append('myJson', myJson)
QUESTION
I'm currently investigating the most appropriate authentication/authorization approach for a greenfield project, to be entirely hosted on Google Cloud Platform. I'm writing this summary to do a sanity check of my preferred approach & seek feedback on whether there are any considerations or inaccuracies I'm unaware of. I would appreciate input from anyone with relevant experience in implementing the associated strategies.
The main queries/concerns I have are:
- How to manage or negate scopes in the OIDC process? It should not be up to the user to authorize appropriate access; this should be set by the org IT admins that created the user
- Can G Suite IT admins apply params to users (custom &/or not) which automatically allocate predefined "Google Identity/IAM" policy groups/roles?
- Will the G Suite users signed JWT's/Google ID be directly compatible with Endpoints + IAP (not requiring any processing/re-encoding)?
- Will this approach accomodate external users via a federated identity approach, in future, without major refactors to the existing process (e.g. Firebase auth)?
Requirements:
- Angular SPA will be the single GUI for the application, hosted on the same domain registered for the organisation on GCP/G Suite
- SPA will use GCP's api gateway (Endpoints) to make requests to GKE micro-services (likely all within the one VPC) & other G Suite services (Drive, etc)
- Org IT G Suite admin's can create users & assign various (predefined) IAM policy groups/scopes via the G Suite UI, to give users least privilege access to org resources (G Suite services & GCP hosted custom api's/apps)
- Users are ONLY able to "sign in with Google" to the SPA, using their orgs G Suite account
- If the User is already signed into their org google account, they should not need to sign in again to the SPA
- While logged into the SPA, the users credentials should be sent with each request, which micro-services will use for authorization of custom business logic, as well as passing those credentials to G Suite services like Google Drive (leverage api scopes authorization as additional layer of security if custom business logic fails)
- In the distant future, there is potential to allow customers/users, external to the org, to utilize various federated identity providers (Facebook, Twitter, etc) to access a SPA & resources hosted by the org (this is not a current requirement, but it is a long term strategic goal)
The two approaches I've determined best fit for purpose are:
1) Endpoints Google Sign-In with IT Apps to obtain the users org Google ID &, as we are using OpenAPI, the GCP Endpoints with an Identity-Aware Proxy (IAP), to manage authentication of the JWT token.
Pros:
- Establishes a clear demarcation between internal users of the UI portal, & potential future external users
- No custom code for IT admins to manage users
- No custom code to sync Firebase & G Suite users, roles, permissions, etc, or access the mirrored G Suite user for credentials
OR, 2) Firebase Firebase authentication, & write code to generate users in G Suite with the Firebase Admin SDK, restricting access to resources based on the org domain.
Pros/Cons are the opposite to Endpoints above, plus no need for 2 separate auth approaches if external users are ever required.
I'm leaning towards the Endpoints approach...
...ANSWER
Answered 2020-Feb-29 at 19:05How to manage or negate scopes in the OIDC process? It should not be up to the user to authorize appropriate access; this should be set by the org IT admins that created the user
Permissions for IAM members (users, groups, service accounts, etc) are managed in Google Cloud IAM. Scopes are used with OAuth to limit permissions already assigned by IAM. Best practices mean assigning the required permissions (and no more) and not combing IAM with scopes.
Can G Suite IT admins apply params to users (custom &/or not) which automatically allocate predefined "Google Identity/IAM" policy groups/roles?
G Suite and Google Cloud are separate services. Google Cloud supports G Suite as an Identity provider (IDP). Permissions are controlled in Google Cloud IAM and not in G Suite. You can combine G Suite with Google Groups to put IAM members into groups for easier IAM management.
Will the G Suite users signed JWT's/Google ID be directly compatible with Endpoints + IAP (not requiring any processing/re-encoding)?
Google Accounts (G Suite) do not provide private keys to its member accounts. Therefore you cannot use Signed JWTs. Signed JWT is an older authorization mechanism and is used with service accounts. The correct method for user credentials is OAuth 2.0 Access and Identity tokens. For administrators, service accounts with Domain Wide Delegation can be used.
Will this approach accomodate external users via a federated identity approach, in future, without major refactors to the existing process (e.g. Firebase auth)?
This is a difficult question to answer. Google Cloud does support external identity providers but I have found this to be problematic at best. You can also use identity synchronization but this is also not well implemented. If you are going the Google Cloud route use G Suite as your identity provider and Google Cloud IAM for authorization.
An important point that I think your question lacks is understanding how authorization works in Google Cloud and Google APIs. These services primarily use OAuth 2 Access Tokens and Identity Tokens. This varies by service and with the type of access required. This means that your application will need to understand the services that it is accessing and how to provide authorization. I have a feeling that you are expecting Firebase/Endpoints to do this for you.
Another item is that Firebase is part of Google Cloud and is only a subset of Google Cloud. Firebase is a great product/service but if you are planning to use Google Cloud features outside of Firebase, then stay with G Suite and Cloud IAM for identity and authorization.
Angular SPA will be the single GUI for the application, hosted on the same domain registered for the organisation on GCP/G Suite
I am assuming by domain you mean DNS Zone (website DNS names). This will make CORS and cookie management easier but is not a requirement.
SPA will use GCP's api gateway (Endpoints) to make requests to GKE micro-services (likely all within the one VPC) & other G Suite services (Drive, etc)
OK - I don't see any problems using Endpoints. However, a good answer requires details on how everything is actually implemented. Another item is that you are mentioning Endpoints and G Suite services. These are very different items. Endpoints protect your HTTP endpoints not other Google services where it would just get in the way.
Org IT G Suite admin's can create users & assign various (predefined) IAM policy groups/scopes via the G Suite UI, to give users least privilege access to org resources (G Suite services & GCP hosted custom api's/apps)
Google Cloud IAM and G Suite authorization are separate authorization systems. In order for G Suite members to manage Google Cloud IAM, they will need roles assigned in Google Cloud IAM via either their member ID or group membership. There is no shared authorization permissions.
Users are ONLY able to "sign in with Google" to the SPA, using their orgs G Suite account
Unless you configure SSO, Google Account members are the only ones that can authenticate. Authorization is managed by Google Cloud IAM.
If the User is already signed into their org google account, they should not need to sign in again to the SPA
That is up to your application code to provide the correct Authorization header in requests.
While logged into the SPA, the users credentials should be sent with each request, which micro-services will use for authorization of custom business logic, as well as passing those credentials to G Suite services like Google Drive (leverage api scopes authorization as additional layer of security if custom business logic fails)
I am not sure what you mean by "User Credentials". You should never have access to a user's credentials (username/password). Instead, your application should be managing OAuth Access and Identity Tokens and sending them to the backend for authorization.
In the distant future, there is potential to allow customers/users, external to the org, to utilize various federated identity providers (Facebook, Twitter, etc) to access a SPA & resources hosted by the org (this is not a current requirement, but it is a long term strategic goal)
I covered this previously in my answer. However, let me suggest clearly thinking about what needs to be authorized. Authorization to your app is different that authorization to your app that also authorizes Google Cloud services. For example, you could use Twitter for authentication and a single service account for Google Cloud authorization. It just depends on what you need to accomplish and how you want to manage authorization.
[UPDATE]
One term that you use in your question is SPA. In the traditional use case, all processing is being done by your application in the browser. This is a security nightmare. The browser will have access to the OAuth tokens used for authorization and identity which is not secure. This also limits your application's ability to generate Refresh Tokens which means the user will need to reauthenticate once the existing tokens expire (every 3,600 seconds). For the scope of this question, I recommend rethinking your app into a more traditional client/server design. Authentication is handled by your servers and not directly by (inside) the client application. In the sections where I mention service accounts, I am assuming that backend systems are in place so that the client only have an encrypted session cookie.
QUESTION
I am looking to integrate FirebaseAuthUI to handle authenticating users to my app.
Currently, the app has an in house authentication method, which allows users to signup and signin with their email address and a password.
We have over 100,000 users who are signed up with our app using our in house auth mechanism, therefore I need to come up with a way to migrate existing users who signed up on the in house system to now be able to sign in with Firebase.
Ideally, I would like to use the FirebaseAuthUI component as it handles the auth flow for various providers, much simplifying the client side code for authentication.
However, I can't see any clear migration path to allow existing users to auth with Firebase and to then pair up the returned Firebase user with that user in our back end to perform migration.
Is this a common problem that has been solved before? Or is FirebaseAuthUI for more greenfield projects where migration of existing users is not required?
...ANSWER
Answered 2020-Feb-07 at 15:50When migrating from another authentication system, you'll typically want to import the user data into Firebase Authentication using the auth:import
command of the Firebase CLI, or the Admin SDK. At this point you can also set your own, existing UID, instead of having to map the new one from Firebase and from your existing system.
By importing the users you are pre-creating the existing user's accounts in Firebase, so that they can immediately sign in (instead of having to sign up) using Firebase.
QUESTION
I'll be starting on a greenfield project in a few months.
The project will contain lot's of business logic, spread over several subdomains
. Yes, we'll be using principles of Domain Driven Design
.
Tech will consist of Spring, Spring Boot & Hibernate
stack.
I was looking after some Java libs to cover infrastructural things like:
domain event publication
event store
event deduplication
resequencers
on consumer sideprojections
reliable publishing
reliable delivery & redelivery
- ...
I came across the Axon Framework
. I already heard about it, didn't know it in details. So I read some blogposts, little bit of documentation and watched some broadcasts on Youtube.
It seems very promising, I'm considering to use it because I don't want to reinvent to wheel over and over again on the infrastructural side.
So I'm looking for someone to answer and clarify my questions:
Axon use CommandHandlers
with void
methods. Is it possible to make them return a value (for instance a generated business id) or objects for notification purposes concerning the business operation?
It's not a issue to me that the method will be I/O blocking by this.
I want to have a clear separation of local
vs remote
domain events.
Local domain
events should only be visible and consumed to the local subdomain. Is it possible to configure event consumption sync and/or async?
My Local domain events can be 'fat'. They are allowed to carry more data because it won't cross the domain boundaries.
Remote domain events
will be 'thin', so only the minimum data necessary for remote domains. This type op events need always to be handles async.
Is it possible to convert a local (fat) domain event to a remote (thin) domain event at the edge of a domain? By 'edge', I mean the infrastructural side. By this, the domain model doesn't need to know distinction between local & remote domain events.
My application will consist of 1 (maybe 2) core domains
and several subdomains
. Some domains contain lot's of business logic and will require CQRS
.
Other domain will be more 'crudy' style.
Is it possible to do CQRS
synchronously?
I want to start this way before adding technical complexities like async handling. It this plossible with Axon
?
This also means that domain events will be stored in a events store without using event sourcing
.
Can Axon's event store
be used without event sourcing?
Same for projection stuff, I just want to projection domain events to build my read model.
We'll use a modular monolith
.
Not very trendy these days with all the microservices
stuff. Although, I'm convinced of having a monolith where each domain is completely separated (application code & DB-schema), where operations will be handled with eventual consistency and domain events contain the necessary data.
Later on, and if necessary, it will be easier to migrate to a microservices architecture
.
Is Axon a framework that fits in a modular monolith kind of architecture? Is there anything to take into account?
The domain model will be completely separated from the data model.
We need to have a repository that reads a data model (using Hibernate
) and uses a data mapper
to create an aggregate when it needs to be loaded.
The other way is also needed, an aggregate needs to be converted and saved into the data model (using data mapper).
Additionally, the aggregates's domain events need to be stored into an event store and published to local or remote event handlers.
This has some consequences:
we need to have full control of repository implementation that communicates with one or more DAO's (Spring data repositories) to take the necessary data out of Hibernate entities and construct an aggregate with it. An aggregate might be modeled in 2 or even 3 relational tables after all.
we don't need any Hibernate annotation in the domain model
Is this approach possible with Axon? I only see examples using direct JPA (domain model maps 1 to 1 to entities) or event sourcing.
This approach is really a deal breaker for us, a separated domain model gives so much more possibilities than mapping it directly to data entities.
Below an example of what I want to achieve:
Aggregate (without JPA) in some domain model package:
ANSWER
Answered 2020-Jan-20 at 18:57I hope I can answer some of them, but I'm also not really experienced in using Axon:
Return values from command handler - Yes, thats possible. We had an example where we return the generated aggregate id (I'm not 100% sure about this answer)
Local vs remote domain events publication - Yes, Axon Server ENTERPRISE (!) supports multi-context thats build for this purpose. https://axoniq.io/product-overview/axon-server-enterprise
CQRS synchronously - The question is not totally clear but it's not necessary to model your complete system with CQRS. You can use CQRS for some domains and other architecture for subdomains.
Use Saga's for any kind of "transaction" like stuff. Rollbacks should be written by the developer. The system can't do this for you.
Modular monolith - Shouldn't be a technical problem.
Fully separated domain model (persistence agnostic) - The question is not totally clear but store only events in Axon Server. Aggregates are build up by a sequence of aggregates. Don't use any other data for it. The aggregate are used to do the command handling with state checks and apply new events.
I a system gets a command message, Axon Framework will look at the aggregate id and re-creates the aggregate by replay all the existing events for that aggregate. Then the method for @CommandHandler and command message type is called on the aggregate with the state of the system. Don't do this by yourself.
On the other hand. Create own custom projections (view models) by listening to the events (@EventHandler) and store the data in your own format to any kind of data models/repository. You can for example build a REST api on top of this to use the data.
Axon Server - Use it where it's built for. Use it as event store and not for other purposes.
See for more info and why: https://www.youtube.com/watch?v=zUSWsJteRfw
QUESTION
In this tutorial, the section "Making new strings from old parts" gives the task of cutting out undesired data to a achieve human-readable format for train station names.
e.g.
Original string: MAN675847583748sjt567654;Manchester Piccadilly
Desired string: MAN: Manchester Piccadilly
ANSWER
Answered 2020-Jan-16 at 05:37Going to the tutorial, your code block isn't valid javascript and not working. You can confirm this by pasting the code in the console. Starting a string with ' requires it to finish with '. Using " hasn't signalled for it to end the string and instead becomes part of it.
The tutorial input window doesn't seem to alert you of any errors or update the output when the code cannot execute. I can replicate your issue by selecting show the solution then pasting your code over it. The correct answer remains but that it due to the solution code.
That + 1 is needed to select the character after the semicolon, which will be the start of the station name.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install greenfield
On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Installers can be used to install a specific or multiple Ruby versions. Please refer ruby-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page